是否可以将DataGrid排序限制为有限的列? 例如,如果我有第1,2和3列。我只希望在用户单击第1列和第2列的标题时对数据进行排序,并且在单击第3列的标题时不会发生任何事情。
另外,我如何获取当前已排序列的信息。
谢谢
Is it possible to restrict DataGrid sorting to limited columns? For example, If I have columns 1, 2 and 3. I only want data to sort when user clicks header of column 1 and 2 and nothing should happen when header of column 3 is clicked.
Also how can I get the information which column is currently sorted.
Thanks
最满意答案
即使它可能是重复的,我也可以提出问题+1。
每个DataGrid列都允许指定用户是否能够对列进行排序。
看看这个链接。
http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridcolumn.canusersort%28v=vs.110%29.aspx
现在,为了禁用排序,只需将DataGridColumn.CanUserSort设置为false即可。
+1 from me for the question even though it is probably a duplicate.
Every DataGrid column allows to specify if user shall be able to sort the column.
Take a look at this link.
http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridcolumn.canusersort%28v=vs.110%29.aspx
Now in order to disable sorting just set DataGridColumn.CanUserSort to false.
更多推荐
发布评论