如何在 WPF 工具包数据网格“过滤器扩展”中保存过滤器值?
我正在使用我在文章“Automatic WPF Toolkit DataGrid Filtering”下找到的代码(VS2008),其中效果很好。它是作为数据网格标题的新“样式”实现的,而不是作为数据网格本身的扩展。我的问题是如何保存输入到这些过滤框中的值,然后使用它们重新输入这些值?
如果不可能,我将如何修改过滤器的源代码(可从上面的链接获取)(WPF 新手)。
谢谢,
恩里科
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
没有太多时间深入代码分析,但您可以在提供的代码中找到:
在
Generic.xaml
的line 55
中,您将找到以下代码:此代码实际上设置了 GridColumn 的模板。在 那个
XAML
的中间,您会找到DelayTextBox
类型声明。那是你的钥匙!从
DelayTextBox
类型的OnTextChanged(TextChangedEventArgs e)
开始搜索。再次提示:
在
DataGridColumnFilter.cs
中,您将找到以下属性:在
get/set
处放置断点,运行程序并过滤列。您将获得清晰的callstack
愿景,因此可以根据您的应用设计决定在哪里获取文本框的实际值。编辑
看看
FilterData
类型,我认为它包含您需要的信息。希望这有帮助。
问候。
Don't have too much time to go deep into the code analysis, but you can find in code provided:
In
Generic.xaml
atline 55
you will find this code:This code actually sets the template for the GridColumn. In the middle of that
XAML
you will findDelayTextBox
type declaration. That is your key !From
DelayTextBox
type'sOnTextChanged(TextChangedEventArgs e)
begins the search.Just another hint again:
In
DataGridColumnFilter.cs
you will find the following property:Put breakpoint to
get/set
, run the program and filter the columns. You will get a clearcallstack
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.
您可以将它们保存到
UserSettings
。我将为每个过滤器条目创建一个用户条目,并在加载时填充过滤器。You can save them to the
UserSettings
. I would create an user entry for each filter entry and on load, populate the filter.