WPF listview对动态数据进行分组 [英] WPF listview grouping on dynamic data
问题描述
我有一个动态填充的列表视图,我根据他们的MD5校验和对项目进行分组。一切都很好,但我希望将这些MD5代码转换为数字。我的意思是组应显示标题组1,组2等。
组名称数等于唯一MD5值的数量。对静态数据进行分组非常简单,因为数字已知。到目前为止,我还没弄清楚如何为动态数据做这件事。
嗨Waleed,
根据你的描述,你想将MD5代码转换成一个数字,我建议你用IValueConverter来做这个,有一个关于如何使用Ivalueconverter的文档,你可以看看:
http://www.wpf-tutorial.com/data-binding/value -conversion-with-ivalueconverter /
您可以根据需要修改代码。
最诚挚的问候,
I have a listview which is populated dynamically, I am grouping items based on their MD5 checksum. Its all good but I would like those MD5 codes to be converted to a number. What I mean is Groups should be displayed with headings Group 1, Group 2 etc. Number of Group names is equal to the number of unique MD5 values. Grouping on static data is extremely simple as the number is already known. I havent been able to figure out how to do it for dynamic data till now.
Hi Waleed,
According to your description, you want to converter MD5 code to a number, I suggest you use IValueConverter to do this, there is a document on how to use Ivalueconverter, you can take a look:
http://www.wpf-tutorial.com/data-binding/value-conversion-with-ivalueconverter/
You can modify the code according to your needs.
Best Regards,
这篇关于WPF listview对动态数据进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!