Wpf - 如何基于datagrid itemssource创建一个contextmenu过滤器? [英] Wpf - how to create a contextmenu filter based on datagrid itemssource?

查看:120
本文介绍了Wpf - 如何基于datagrid itemssource创建一个contextmenu过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

如问题所述,我想为DataGridView创建一个基于菜单的过滤器。为了实现这一目标,我需要解决以下两个问题。



1 - 可以将CollectionViewSource(已分组)绑定到MenuItem.ItemsSource ??



2 - 我可以为日期类型实现相同的功能,按年,月和日对项目进行分组(如树视图)



我已经为CollectionViewSource.GroupDescriptions实现了PropertyGroupDescription的转换器,但我不知道如何使用它们来构建菜单。



也许有人在那里有解决了这些场景,你可以给我链接参考o任何建立的样本,我将不胜感激任何评论或解决方案。提前致谢。



我的尝试:



我'谷歌搜索了很多并实现了一些东西,但没有具体或有用

Hi friends,
As the question describes, I want to create a menu-based filter for a DataGridView. To achieve this hit, I need to solve the following two questions.

1 - It's is possible to bind the CollectionViewSource (grouped) to a MenuItem.ItemsSource??

2 - Can I implement the same for date type, grouping items by year, month and day (like treeview)

I already implemented converters for PropertyGroupDescription for CollectionViewSource.GroupDescriptions but I don't know how to use them to build the menu.

Maybe someone out there has solved these scenarios and you can give me links for reference o any built sample, I would appreciate any comment or solution. Thanks in advance.

What I have tried:

I've Googled a lot and implemented some things but nothing concrete or useful

推荐答案

你好,

我认为你的问题与这个问题有关:
hello,
I think your question is related to this questions:
Binding object within object properties into a WPF Datagrid




这篇关于Wpf - 如何基于datagrid itemssource创建一个contextmenu过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆