Hello,I'm using the XamDataGrid with DataSource containing a list of comma-separated strings. By default the filter row dropdown includes all items presented in grid. But in this case I would like to bind the filter dropdown to other property of viewmodel containing just the values which are presented in the grid as strings. Is there a way to do this? For better understanding I made a screenshot of how the dropdown looks currently:
What I want is that the dropdown contains each item (F01, F02 etc.) only once.Thanks in advance and kind regards,Daniel
Hi Rob,that worked, thank you!Regards,Daniel
Hi Daniel,
Let me know if you have any further questions on this matter.
Hi Daniel
I don't quite understand what you have so far. When you say TreeItems do you mean the ItemsSource of the tree control? Although yes I would also expect that they wouldn't be recognized as filter items. I think adding the filters programmatically would be the simplest approach since adding a filter is pretty straight forward. This doc shows how you can add filters programmatically: http://help.infragistics.com/doc/WPF/2014.2/CLR4.0/?page=xamDataPresenter_Add_Filter_Conditions.html
Hi Rob,
thank you, that worked! I have one more question for you: if I implement a property in my ViewModel (a list of strings) and set this property as TreeItems in the control template for the filter this items are not recognized as filter items (I've actually expected that). The question is: is there a simple way to convert them to filter items or should I make a list of checkboxes and implement the filter in code-behind (if yes, how do I set the filter of a XamDataGrid programmatically).Thanks in advance,Daniel
Do you mean how do you access your view model from the style? The RecordFilterTreeControl contains a Field property. From here you can access the DataContext of the XamDataGrid which I would imagine is your view model.
"{Binding Field.Owner.DataPresenter.DataContext, RelativeSource={RelativeSource TemplatedParent}}"