Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

x:Bind in windows 10 Mode One way : I am trying to update the bind list when scrollview reached to and end.

$
0
0

If i tried to use TwoWay mode, It shows below error:

Error : Invalid binding path 'itemsList' :

Cannot bind type 'System.Collections.Generic.List(System.String)' to 'System.Object' without a converter


My XAML code:<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> My CS code: 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); } }




Viewing all articles
Browse latest Browse all 18858

Trending Articles