Hi,
WPF XamGrid. Release 2017.1
I'm looking for a way to set multiple values to column filter programmatically, so the grid would behave exactly like the same actions were done manually, i.e. if there are values 1,2,3,4 in the column filter value list, I need to have some code which would set 1,2,4 as filter so the grid shows only rows with value 1 or 2 or 4 in the said column, but the user must have a way to change the filter without reset (for example, exclude 4 from the filter value list).
I use Excel filter mode as it is allows for filter value list being displayed to user.
Samples I've seen either support a single value as filter, or require custom operand which I believe won't allow for user to change the filter value list.
Any help would be greatly appreciated.
Alex
Hello Alex,
In order to set multiple values to the XamGrid's FilterMenu programmatically, I would recommend that you populate the XamGrid.FilteringSettings.RowFiltersCollection with a new RowsFilter object. This RowsFilter takes an Infragistics.ComparisonCondition in its Conditions collection and you can also designate a Column to place the filter on. The ComparisonCondition takes an Operator and a FilterValue, and you can add multiple ComparisonConditions to a single RowsFilter.Conditions collection, or simply use the "In" operand for the ComparisonCondition.Operator.
After adding this RowsFilter to the XamGrid.FilteringSettings.RowFiltersCollection, the FilterMenu should update accordingly, and I have attached a sample project to demonstrate this.
Please let me know if you have any other questions or concerns on this matter.
7875.XamGridProgrammaticFilterMenuDemo.zip
Sincerely,AndrewAssociate Developer