Hello,
I need to set a filter programmatically in XamGrid (13.2.20132.2284). I used code from this help topic http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/ that works OK if AllowFiltering is set to FilterRowTop. However, it does not work if AllowFiltering is set to FilterMenu. What am I missing? I tried adding filters to FilteringSettings.RowFiltersCollection, but that does not have any impact.
Thank you.
Hello Serge,
Thank you for your post.
I have been looking into it. I created a sample application based on your scenario and I could not managed to reproduce the behavior that you have described. I set the Filtering setting of XamGrid to FilterMenu by code behind and it works. If you are not able to reproduce the issue with the attached sample application, would you please modify it with the functionality, that you are using, so it reproduces the issue. This way I would be able to further investigate this for you and provide you with more detailed information on this matter.
You can read more details for the filtering in XamGrid from the following link in our on-line documentation:
http://help.infragistics.com/Help/Doc/WPF/2012.1/CLR4.0/html/xamGrid_Filtering.html
Would you please attached the correct link for the approach that you have used.
Looking forward to hearing from you.
Hello Zhivko,
The correct URL is http://help.infragistics.com/Help/Doc/WPF/2014.2/CLR4.0/html/xamGrid_Programmatically_Create_a_Filter.html
I tried to use it for the FilterMenu and it does work.
However, the filter menu implementation supports multiple filter conditions combined with "And" or "Or". The grid column FilterColumnSettings only supports single condition. Is there a way to work around this limitation? I'm currently using version 13.2 but I can upgrade to latest if this feature was added in version 14.
Thank You,
Serge
I have been investigating the behavior that you want to achieve. What I can suggest is to create a custom class that inherits from FilterOperand. In it you can create a filter expression that returns the items you want and set it as FilteringOperand to some column. I created a short sample application based on your scenario to show you how you can implement this functionality. In the sample I created custom class MyCustomFilterExpr that inherits from FilterOperand. I override the RequiresFilteringInput method and create a filter expression function that returns the items that meet the conditions. I set the FilterColumnSettings.FilteringOperand to new instance of this class.
Please let me know if you need any further assistance on this matter.
Unfortunately, this does not apply to my user scenario. In my use case, the user can make any filter selection in the grid including selection of multiple column and applying multiple standard conditions per filter column. My program is supposed to save this selection and then restore it exactly the same way next time the grid is opened.
I have been investigating your requirements. What I can suggest is to use our Persistence Framework in order to be able to achieve your requirement. It enables you to save and load the current state of controls. You can read more details about it from the following link from our online documentation:
http://help.infragistics.com/doc/WPF/2014.1/CLR4.0/?page=Persistence_About_IG_Control_Persistence_Framework.html
I created a small sample application to show you how you can implement this approach. In the sample application I used Save and Load methods of PersistenceManager to save and load the current settings of XamGrid .I take the current setting and save it in a xml file, when closing the XamGrid. I handled the loaded event of XamGrid and in the event handler I load the xml file that contains setting, if it exist.
I am just checking if my last reply was helpful for you.
If you require any further assistance please do not hesitate to ask.