What is the best way to filter a DomainDataSource(DDS) on the client?
My DDS connects to the WCF Ria Service and downloads a number of items. I want to show bits of this information in different controls. eg a few ItemsControls showing items from the DDS filtered by various values. I know I could create a new DDS for each control and filter on the server but I would rather only make 1 trip.
I have tried using an iValueConverter to do the filtering. eg
ItemsSource="{Binding Data, ElementName=PermissionsByUserDS, Converter={StaticResource PermissionsByTypeConverter}, ConverterParameter={StaticResource GeneralPermissions}}"
This works fine when the controls are first databound but they are not updated when the DDS reloads its data. If I remove the converter, the ItemsControls update as expected but obviously then I am not getting the filtering.
I can also do the filtering and binding manually in code everytime the DDS updates but I am not sure that this is the best approach.
Any suggestions?
You might want to take a look at the CollectionViewSource. It allows filtering of collections.
http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource.filter(VS.95).aspx
http://microsoft.realdolmenblogs.com/post/CollectionViewSource-in-Silverlight.aspx
http://www.mokosh.co.uk/post/Silverlight-3-CollectionViewSource.aspx