开发者

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

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 mod开发者_运维百科ifying the source code (available from link above) to the filter (WPF newbie).

Thanks,

Enrico


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.


You can save them to the UserSettings. I would create an user entry for each filter entry and on load, populate the filter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜