0
votes

I have a LongListSelector Element with an ItemsSource like ItemsSource="{Binding MyList}" MyList is a ObservableCollection of MyObj. MyObj has two attributes an ID and a Name.

I'd like to filter MyList that only elements with the Name "test" will be displayed.

Can I do this in xaml code?

Thanks

2

2 Answers

2
votes
1
votes

You can't filter your list in xaml, alter your ObservableCollection in your code behind. In case you are using C# this would be:

MyList = new ObservableCollection<MyObj>(allItems.Where(x => x.Name == "test"));