0
votes

I'm trying to two ListViews in snyc (one being display when the app is in Fullscreen, one for snapped view). This is mainly done so I can work with the SelectionChanged-Event of the main ListView. Unfortunately, using WinRTXamlFramworks BindableSelection just results in an Error:

Error: BindingExpression path error: 'FilterListView' property not found on 'System.Collections.ObjectModel.ObservableCollection1[[Filter.FilterType, Filter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. BindingExpression: Path='FilterListView' DataItem='System.Collections.ObjectModel.ObservableCollection1[[Filter.FilterType, Filter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'; target element is 'Windows.UI.Xaml.Controls.ListView' (Name='FilterListViewSnapped'); target property is 'BindableSelection' (type 'Object')

From the error I assume this has something to do with the ItemSouce-Binding, but I'm not sure on how to fix that. Any ideas?

Here's my XAML:

<ListView Grid.Row="1" 
    Name="FilterListView" 
    SelectionMode="Single" 
    ItemsSource="{Binding}" 
    SelectionChanged="FilterListView_SelectionChanged">

<ListView x:Name="FilterListViewSnapped"
    Grid.Row="3" 
    ScrollViewer.VerticalScrollMode="Enabled" 
    ItemsSource="{Binding}" 
    SelectionMode="Single" 
    IsSwipeEnabled="false" 
    XamlToolkit:ListViewExtensions.BindableSelection="{Binding FilterListView, Mode=TwoWay}" >
1

1 Answers

0
votes

"{Binding FilterListView, Mode=TwoWay}" binds to the property "FilterListView" of FilterListViewSnapped's DataContext. IIRC for a ListView DataContext is generally the same as the ItemsSource.

If you want to bind to the ListView named "FilterListView", use this: "{Binding ElementName=FilterListView, Mode=TwoWay}".