views:

324

answers:

1

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?