Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I save filter values in WPF toolkit datagrid "filter extension"?

Tags:

c#

wpf

wpftoolkit

I am using the code (VS2008) I found under the article "Automatic WPF Toolkit DataGrid Filtering", which works very well. It is implemented as a new "style" for a datagrid's header, NOT as an extension of the datagrid itself. My question is how can I save the values entered into those filter boxes, and later use them to re-enter those values?

If not possible as is, how would I go about modifying the source code (available from link above) to the filter (WPF newbie).

Thanks,

Enrico

like image 552
Enrico Cianni Avatar asked Aug 03 '11 18:08

Enrico Cianni


1 Answers

Don't have too much time to go deep into the code analysis, but you can find in code provided:

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

<Setter Property="Template">

This code actually sets the template for the GridColumn. In the middle of that XAML you will find DelayTextBox type declaration. That is your key !

From DelayTextBox type's OnTextChanged(TextChangedEventArgs e) begins the search.

Just another hint again:

In DataGridColumnFilter.cs you will find the following property:

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

Put breakpoint to get/set, run the program and filter the columns. You will get a clear callstack vision, so can decide where you can pick up the actual value of the textbox, based on your app design.

EDIT

Look at FilterData type, it, I think, contains an information you need.

Hope this helps.

Regards.

like image 166
Tigran Avatar answered Oct 27 '22 17:10

Tigran