I have a user control with few elements inside, one of the element I want to set it's background to Transparent, but I dont want the user of this control to be able to change it using Styles.
: 开发者_运维百科for example
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" Value="{StaticResource DisabledBackground}" />
<Setter Property="Foreground" Value="{StaticResource DisabledForeground}" />
</Trigger>
this code sets the background of the entire control (including the item I dont want to change).
Any Ideas ?
Can't you just set the background of the control explicitly to transparent? That should override any inherited styles.
精彩评论