Reputation: 2994
I am using XCeed DataGrid for WPF 4.x. I have created excel like drop down filters using view's ItemProperties.
(read)
? And also how to set these check boxes from code behind(write)
?Main purpose: To retain previous excel like filter applied by user when data grid item source is changed. [In case of above example after #2, if I change items source from {1,1,0,1} to {0,0,0,0} then user should not be able to see even a single row in grid]
Upvotes: 2
Views: 1415
Reputation: 513
This can be done by accessing the AutoFilterValues collection on the underlying DataGridCollectionView in which the DataGridControl is bound.
Lets say your DataGridControl instance is "grid"
read:
( grid.ItemsSource as DataGridCollectionView ).AutoFilterValues[ "column header" ]
write: ( grid.ItemsSource as DataGridCollectionView ).AutoFilterValues["column header"].Add(0);
Upvotes: 1