我正在尝试更新绑定到ListBox的列表,当滚动条到达末尾时,我需要更新列表并显示UI also.Here中的更改它不是正在更新automatically.Can有人请帮助我满足我的要求。
如果我尝试使用TwoWay模式,它会显示以下错误:
错误:绑定路径'itemsList‘无效:没有转换器,无法将类型'System.Collections.Generic.List(System.String)’绑定到'System.Object‘
<ScrollViewer
x:Name="sv"
ViewChanged="OnScrollViewerViewChanged">
<ListBox x:Name="listView"
HorizontalAlignment="Left"
Height="Auto"
VerticalAlignment="Top"
Width="172"
ItemsSource="{x:Bind itemsList, Mode=OneWay}"/>
</ScrollViewer>和代码
public List<String> itemsList = new List<string>();
private void OnScrollViewerViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
{
var verticalOffset = sv.VerticalOffset;
var maxVerticalOffset = sv.ScrollableHeight; //sv.ExtentHeight - sv.ViewportHeight;
if (maxVerticalOffset < 0 ||
verticalOffset == maxVerticalOffset)
{
// Scrolled to bottom
Util.debugLog("REACHED BOTTOM");
int i;
// itemsList = null;
itemsList.Clear();
for (i = 0; i < 20; i++)
{
itemsList.Add("Item number " + i + 900);
}
}
else
{
// Not scrolled to bottom
// rect.Fill = new SolidColorBrush(Colors.Yellow);
}
}发布于 2015-06-30 21:08:53
https://stackoverflow.com/questions/31130948
复制相似问题