collectionviewsource

How to automatically update filter and/or sort order on CollectionViewSource, when an individual item's property changes?

Ok, so this question is related to Windows Phone 7/Silverlight (updated WP7 Tools, Sept 2010), specifically filtering an underlying ObservableCollection<T>. In mucking about with the WP7 template Pivot control application, I've run into an issue whereby changing an underlying item in an ObservableCollection<T>, does not result in the on...

Entity Framework 4 - Sorting by foreign entity

I get "'System.Windows.Data.BindingListCollectionView' view does not support sorting." when I use the following CollectionViewSource: <CollectionViewSource Source="{Binding Path=CourseSessions}" x:Key="cvsCourses"> <CollectionViewSource.SortDescriptions> <ComponentModel:SortDescription PropertyName="StartDate"/> ...

CollectionViewSource Filtering logic

The design I've come up with for filtering is awkward at best, and buggy at worst. The idea is to have a base class to support a pick list, and let subclasses add on additional filtering logic as needed. What is particularly confusing to me is how to trigger the view to filter as various filtering criteria change (see _ApplyFiler(), bel...

CollectionViewSource Filtering Event vs Property

What are some of the practical differences between using the CollectionViewSource.View.Filter property as opposed to the CollectionViewSource.Filter event? Are there situations where you would use one over the other or is it a matter of preference? Cheers, Berryl EDIT: I do see that the docs say "If your view object comes from a Colle...

CollectionViewSource CurrentChanged not triggering

I wonder if I am doing something wrong? My CurrentChanged does not seem to trigger. It only triggers on application start ListItems = new ObservableCollection<string>(); ListItems.Add("hello"); ListItems.Add("world"); ListItems.Add("foo"); ListItems.Add("bar"); ListItems.Add("baz"); viewSource = CollectionViewSource.GetDefaultView(ListI...

DataGrid is not obedient to SelectedIndex property set

I need to make the DataGrid, so if I am in edit mode, and the current row is not valid, the user should not be able to select a different row. In fact, I think that the DataGrid is supposed to avoid selection of another row once the CollectionChangingEventArgs of the CollectionView is flagged for cancellation, the DataGrid should stick ...

Can you use a CollectionViewSource inside a DataTemplate?

Is it possible to explicitly use a CollectionViewSource inside a data template? Normally we'd put the CollectionViewSource in the resources alongside the template, but our model doesn't allow that because the 'source' of the collectionviewsource is a property of the DataContext at this level in the tree, meaning there needs to be an ins...

C#/WPF: Why is tab not focusing properly

I have a tab control <TabControl Height="Auto" Grid.Row="1" ItemsSource="{Binding Tabs}" IsSynchronizedWithCurrentItem="True"> That is bound to Tabs in the ViewModel. I also used CollectionViewSource to focus tabs protected ObservableCollection<TabViewModel> _tabs; protected ICollectionView _tabsViewSource; public ObservableCollect...

WPF - CollectionViewSource Filter event in a DataTemplate not working

I'm seeing some really weird behavior where WPF isn't doing what I expect it to do. I've managed to boil the problem down the following bit of code: XAML: <Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"...

Collection Binding on CollectionViewSource Source Property

I've a CollectionViewSource as ItemsSource of my DataGrid...on Window.Resources I've this definition: <CollectionViewSource x:Key="ItemsPoolCollectionView" Source="{Binding Path=MyObservableCollection, Mode=OneWay}" /> now, I would do the same definition from code, so I've done this: Dim _cvs as CollectionViewSource = New Coll...