We are using the FilterMenu to filter data in a XamGrid. In some scenarios we have to push ComparisonConditions into the RowFiltersCollection programmatically. Unfortunately these programmatically added conditons aren't shown in the FilterMenu. How can we add ComparisonConditions programmatically such that the user sees them in the FilterMenu and is able to narrow down the filter results based on the programmatically added conditions.
I have added a sample solution.
Hi Svetla,
we tried your example, it works. But if adding filters to the RowFilterCollection programatically and not via the GUI the OnFiltered event is not raised.
In our understandig the event is fired when the grid has done all the filtering and the visible rows in the RowsPanel are updated. Is there a way to call this event in the correct way?
When we call the event manually, the filtering seems not to be finished so the rows in the panel are not already updated.
Thx for your reply.
Hello,
In order to add a filter condition to the filter menu you have to create a custom FilterOperand to be applied.
After that create a FilterMenuTrackingObject with the custom filter operand and finally add the FilterMenuTrackingObject to the Children collection of the xamGrid’s column FilterColumnSettings build-in FilterMenuOperands. This can be done in the Loaded event handler of the xamGrid control.
I’ve attached a modified project demonstrating this for the BankAccount column. Have in mind that this approach modifies the default behavior and is possible to affect the filtering in some way.
Let me know if I may be of further assistance.