UserControl的项目背景

时间:2011-03-03 19:04:49

标签: wpf xaml user-controls

我有一个用户控件,其中包含少量元素,其中一个元素我想将其背景设置为Transparent,但我不希望此控件的用户能够使用样式更改它。

:例如

<Trigger Property="IsEnabled" Value="false">
            <Setter Property="Background" Value="{StaticResource DisabledBackground}" />
            <Setter Property="Foreground" Value="{StaticResource DisabledForeground}" />
        </Trigger>

此代码设置整个控件的背景(包括我不想更改的项目)。

任何想法?

1 个答案:

答案 0 :(得分:0)

难道您不能将控件的背景明确设置为透明吗?这应该覆盖任何继承的样式。