如何从WPF中的datagrid中的复选框列禁用排序 [英] How can I disable the sorting from my checkbox column in datagrid in WPF
本文介绍了如何从WPF中的datagrid中的复选框列禁用排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个DataGrid,其中列的排序是启用的。我想从我的一个栏目中删除有一个复选框的短片
我尝试了什么:
尝试过put绑定启用为false
I have a DataGrid where sorting for column is enable. i want to remove shorting from one of my column which have checkbox
What I have tried:
have tried putting binding is enable as false
推荐答案
谷歌搜索通常有答案...我用这个搜索: wpf datagrid禁用排序 - Google搜索 [ ^ ]
在代码项目中找到这个代码隐藏解决方案:如何使用colum禁用数据网格视图中的排序n标题 [ ^ ]
哪些应该在XAML中大致翻译为:
Google Search usually has the answers... I used this search: wpf datagrid disable sorting - Google Search[^]
And found this code-behind solution here on Code Project: How to disable sorting in datagrid view using column header[^]
Which should translate in XAML roughly to:
<DataGrid>
<DataGrid.Columns>
<DataGridTextColumn CanUserSort="False"/>
</DataGrid.Columns>
</DataGrid>
现在您只需要将绑定连接到CheckBox。
Now you just need to wire in your binding to the CheckBox.
这篇关于如何从WPF中的datagrid中的复选框列禁用排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文