using style in WPF

Posted by Polaris on Stack Overflow See other posts from Stack Overflow or by Polaris
Published on 2010-04-13T08:31:17Z Indexed on 2010/04/13 8:32 UTC
Read the original article Hit count: 350

Filed under:
|

In my application I use ShinyBlue.xaml resourse Dictionary which has this code for GroupBox control:

    <Style TargetType="{x:Type GroupBox}">

    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type GroupBox}">
                <Grid SnapsToDevicePixels="true">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="6" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="6" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="6" />
                    </Grid.RowDefinitions>
                    <Border Grid.ColumnSpan="4" Grid.RowSpan="4" Background="{DynamicResource LightBrush}" CornerRadius="4,4,4,4" BorderThickness="1,1,1,1" />
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>

   </Style>

These style common for all app. But in one of the forms I want to change background to Transparent. I want override only Background Property but it's not work

<Style TargetType="GroupBox" BasedOn="{StaticResource {x:Type GroupBox}}">
    <Setter Property="Background" Value="Transparent"/>
</Style>

code above not works properly

How can I change GroupBox Background in specific form ?.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about style