aKz*_*enT 3 .net wpf xaml listview .net-4.0
我有一个ListView使用GridView布局的很多控件的应用程序.所有这些都使用自定义Style customStyle.我想在所有这些ListView控件中禁用列重新排序.
我可以在不使用现有Style触及所有控件的情况下执行此操作吗?我试过这个,但它似乎不起作用:
<Style x:Key="customStyle"
BasedOn="{StaticResource ResourceKey={x:Type ListView}}"
TargetType="{x:Type ListView}">
<Setter Property="GridView.AllowsColumnReorder" Value="False" />
...
</Style>
Run Code Online (Sandbox Code Playgroud)
谢谢!
更新:如果这不可能,有没有办法在我的应用程序中默认禁用列重新排序?
更新:
我也尝试了这个,这不起作用.可能是因为GridView没有Style属性.
<Style TargetType="{x:Type GridView}">
<Setter Property="AllowsColumnReorder" Value="False" />
...
</Style>
Run Code Online (Sandbox Code Playgroud)
小智 6
这是你应该做的:
在这个样式定义中
<Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}" TargetType="ScrollViewer">
Run Code Online (Sandbox Code Playgroud)
有一个
<GridViewHeaderRowPresenter
Run Code Online (Sandbox Code Playgroud)
它有一个属性allowsColumnReorder硬编码为false.
...
我知道......两岁的线程.但我打赌人们还在读它.
| 归档时间: |
|
| 查看次数: |
3008 次 |
| 最近记录: |