从WPF的ListView调整列prevent用户 [英] Prevent user from resizing columns with WPF ListView
问题描述
我不知道我怎么可以prevent用户从调整GridViewColumns withing一个WPF ListView控件作为谷歌并不想出了机智的解决方案。
i wonder how i can prevent a user from resizing GridViewColumns withing a WPF ListView control as google doesn't came up wit a solution.
大概是WPF大师的看过来之一;)
probably one of the wpf guru's over here ;)
推荐答案
我找到了解决办法,可能会帮助别人一天;)
i found a solution and probably it will help someone else someday ;)
您必须重写GridViewColumnHeader的控件模板(默认模板是这里),并删除< STRONG> PART_HeaderGripper 从模板,以便您的列prevent大小调整。
you have to override the GridViewColumnHeader's ControlTemplate (default template is here ) and remove the PART_HeaderGripper from the template in order to prevent resizing of your columns.
有就是这里描述与子类GridViewColumn来了另一种解决方案。再presentation目的,我preFER XAML唯一的解决办法,虽然
there is another solution that comes up with subclassing GridViewColumn described here. for representation purposes i prefer xaml only solutions though
这篇关于从WPF的ListView调整列prevent用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!