Home Forums WPF controls Xceed DataGrid for WPF Autofilter with additional rules

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #40351 |

    The autofilter control currently has a Clear button, and a checklist box, allowing one to check multiple values for filtering in a column.  I’d like to add a ‘Custom Filter Rules’ entry to this control, which brings up a dialog that I would make, allowing the user to define one or more advanced filtering rules.  Examples would be “Column Value [dropdown selection of: contains text/starts with/ends with/is greater than/etc] [user entered value]”.

     1. How would I add these custom rules to the Datagrid’s filtering engine?

     2. How would I update the autofilter control to add an item that would bring up this dialog?

     

    Imported from legacy forums. Posted by Chris (had 1521 views)

    Xceed Support
    Member
    Post count: 5658

    Hi,
    Some of theses options are already available within the filterRow. As an example, it is possible to insert querries like “<1024” or “>=30” to numeric values.

     However, if filterRow doesn’t correspond your needs, here is some informations to create your own Custom Filter:

    To create a custom auto-filter control this page within our documentation should provide you with enough information to help you.
    http://doc.xceedsoft.com/products/XceedWpfDataGrid/Custom_Auto-filtering_Controls.html

    To add custom rules within our DataGridControl, please use the DataGridCollectionView’s Filter attribute.

            DataGridCollectionView view = MyDataGridControl.ItemsSource as DataGridCollectionView;
            view.Filter = i => FilterFunction((System.Data.DataRowView)i));

        static protected bool FilterFunctionSystem.Data.DataRowView currentRow) //Of course, you may add as many parameters you wish
        {
            //Contents of the filter function.
        }

    Imported from legacy forums. Posted by Sebastien [Xceed] (had 1067 views)

    User (Old forums)
    Member
    Post count: 23064

    Many thanks Sebastien.  I wasn’t aware that queries were available in the filterRow, and after reading the Custom AutoFiltering Controls page, it looks like I can accomplish what I need.

    Imported from legacy forums. Posted by Chris (had 661 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.