phép nói rằng tôi có dưới đây:Làm thế nào để làm cho Style.Triggers kích hoạt một phong cách đặt tên khác nhau được áp dụng
<Style TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Gray" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="true">
<Setter Property="BorderBrush" Value="Green" />
<Setter Property="BorderThickness" Value="2" />
</Trigger>
</Style.Triggers>
</Style>
này hoạt động tốt và không có gì quá nhiều sai lầm là ở đây, nhưng nó là một trường hợp khá đơn giản . Chuyện gì xảy ra nếu tôi muốn có tình trạng phong cách IsFocused liệt kê như là một phong cách exsplicit làm thế nào để tham khảo phong cách như là phong cách IsFocused, tức là
<Style x:key="ActiveStyle" TargetType="{x:Type TextBox}">
<Setter Property="BorderBrush" Value="Green" />
<Setter Property="BorderThickness" Value="2" />
</Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Gray" />
<Style.Triggers>
<Trigger Property="IsFocused" Value="true">
-- Here I want to reference ActiveStyle and not copy the copy the setters
</Trigger>
</Style.Triggers>
</Style>
Không lý tưởng Tôi đồng ý nhưng sẽ phải làm ơn cảm ơn – vdhant