【C#/WPF】ListView的MVVM例子,及禁止拖动ListView的头部Header
2021-03-23 00:27
标签:tag 改变 设置 mem target ice head rop package
一个ListView的MVVM简单例子: 运行后效果如下(未填充任一条目): 发现问题:用户可以自由拖拽以改变头部的宽度!需要禁止这一操作。 给设置它的头部样式为禁用即可,代码如下: 重要参考: http://stackoverflow.com/questions/181956/prevent-user-from-resizing-columns-with-wpf-listview 【C#/WPF】ListView的MVVM例子,及禁止拖动ListView的头部Header 标签:tag 改变 设置 mem target ice head rop package 原文地址:https://www.cnblogs.com/lonelyxmas/p/9473453.htmlListView ItemsSource="{Binding GoodsList}" Margin="0,10,0,10">
ListView.View>
GridView>
GridViewColumn Header="套餐编号" Width="120" DisplayMemberBinding="{Binding packageNo}" />
GridViewColumn Header="数量" Width="120" DisplayMemberBinding="{Binding num}" />
GridViewColumn Header="单价" Width="120" DisplayMemberBinding="{Binding price}" />
GridViewColumn Header="总金额" Width="120" DisplayMemberBinding="{Binding totalAmount}" />
GridViewColumn Header="选择" Width="120">
GridViewColumn.CellTemplate>
DataTemplate>
RadioButton GroupName="package" Checked="RadioButton_Checked"/>
DataTemplate>
GridViewColumn.CellTemplate>
GridViewColumn>
GridView>
ListView.View>
ListView>
(谷歌搜wpf lock listview header)
下一篇:springboot添加拦截器
文章标题:【C#/WPF】ListView的MVVM例子,及禁止拖动ListView的头部Header
文章链接:http://soscw.com/index.php/essay/67716.html