I want to switch from WinForms to WPF and so far I can’t enter at all, I need to hang a filter on the DataGrid column, I found this solution and I don’t understand how to connect it to the project at all. Please clarify. In WinForms, the library has connected and used it, but how?

  • @FoggyFinder I need to have a button in the column header as an exele to filter the dropdown data sheet. As in winforms datagridautofilter. - Winteriscoming

1 answer 1

DevExpress did not use, but the project under the second link is quite working. The only thing the author for some reason distributes the solution through the ClickOnce installer.

In general, the only library ItemsFilter.dll is enough for work. Therefore, if you do not want to run the ClickOnce installer, then after unpacking the downloaded archive, you can go to "Application Files \ ItemsFilter.NET.Sample_1_1_0_1", take the file ItemsFilter.dll.deploy and remove .deploy from the file name, then add this library to the project . The rest of the files on the idea relate to the demke from the author, they did not check.

Well, then you work as with a regular grid, only replace the standard DataGrid with bsFilter:FilterDataGrid . Add a headline:

 xmlns:bsFilter="http://schemas.bolapansoft.com/xaml/Controls/ItemsFilter" 

And implement the grid, for example:

 <bsFilter:FilterDataGrid ItemsSource="{Binding ItemsCollection}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="String" Binding="{Binding StrValue}" /> <DataGridTextColumn Header="Date Time" Binding="{Binding DateTimeValue}" /> </DataGrid.Columns> </bsFilter:FilterDataGrid> 

... where ItemsCollection is a collection ( ObservableCollection ) of objects, which in this example contain the StrValue and DateTimeValue properties.

The result is:

enter image description here

enter image description here