How to save filter values ​​in WPF toolkit datagrid "filter extension"?

I am using code (VS2008), which I found in the article " Automatically Filtering DataGrid Toolkit WPF ", which works very well. It is implemented as a new β€œstyle” for the datagrid header, and not as an extension of the dataset itself. My question is: how can I save the values ​​entered into these filter fields and then use them to re-enter these values?

If this is not possible, how would I like to change the source code (available from the link above) to a filter (WPF newbie).

Thanks,

Enrico

+6
source share
2 answers

It does not take too much time to delve into the analysis of the code, but you can find in the code:

In Generic.xaml on line 55 you will find this code:

 <Setter Property="Template"> 

This code actually sets the template for the GridColumn. In the middle of this XAML you'll find a declaration of type DelayTextBox . This is your key!

From the DelayTextBox enter OnTextChanged(TextChangedEventArgs e) beginning of the search.

Another hint:

In DataGridColumnFilter.cs you will find the following property:

 public FilterData FilterCurrentData { get { return (FilterData)GetValue(FilterCurrentDataProperty); } set { SetValue(FilterCurrentDataProperty, value); } } 

Put a breakpoint on get/set , run the program and filter the columns. You will get a clear vision for callstack , so you can decide where you can get the actual value of the text field based on the design of your application.

EDIT

Look at the FilterData type; I think it contains the information you need.

Hope this helps.

Sincerely.

+2
source

You can save them in UserSettings . I would create a user record for each filter and load record, fill the filter.

0
source

Source: https://habr.com/ru/post/894215/


All Articles