BorderThickness的边框控制无效 [英] BorderThickness of Border control doesn't work
本文介绍了BorderThickness的边框控制无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经定义了以下DataTemplate:
I have defined the following DataTemplate:
<dxg:TableView.DataRowTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<Border BorderThickness="0" BorderBrush="#D0C9A0" Style="{StaticResource borderStyle}">
<dx:MeasurePixelSnapper>
<ContentControl Content="{Binding}" ContentTemplate="{Binding View.DefaultDataRowTemplate}"/>
</dx:MeasurePixelSnapper>
</Border>
</StackPanel>
</DataTemplate>
</dxg:TableView.DataRowTemplate>
我想在行集中时应用这种样式:
And I want to apply this style when the row is focused:
<Style TargetType="Border" x:Key="borderStyle">
<Setter Property="BorderThickness" Value="0"/>
<Style.Triggers>
<Trigger Property="dxg:GridViewBase.IsFocusedRow" Value="True">
<Setter Property="BorderThickness" Value="4"></Setter>
</Trigger>
</Style.Triggers>
</Style>
为什么不起作用?我不明白为什么触发器要执行.有解决办法吗?
Why doesn't it work? I don't understand why the Trigger is noct executed. Any solution?
推荐答案
由< Border BorderThickness ="0" ...>
设置的本地属性值的优先级高于任何设置的值通过样式.因此,触发器设置的值会被静默忽略.
The local property value set by <Border BorderThickness="0" ...>
has higher precedence than any value set by a Style. Hence the value set by the Trigger is silently ignored.
只需删除BorderThickness分配:
Just remove the BorderThickness assignment:
<Border BorderBrush="#D0C9A0" Style="{StaticResource borderStyle}">
...
</Border>
请参见相关性属性值优先级.
这篇关于BorderThickness的边框控制无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文