[]
        
(Showing Draft Content)

WPF Styling

In WPF, you can set styles implicitly. When you set styles implicitly all instances of a particular type can be styled at once. For example, the WPF C1DropDown control might be styled with the following markup:

<Grid>
    <Grid.Resources>
        <Style TargetType="{x:Type c1:C1DropDown}">
            < Setter Property="Background" Value="Red" />
        < /Style>
    </Grid.Resources>
    <c1:C1DropDown Height="30" HorizontalAlignment="Center" Name="C1DropDown1" VerticalAlignment="Center" Width="100" />
</Grid>

This would set the background of the control to be the color red.


All C1DropDown controls in the grid would also appear red; C1DropDown controls outside of the Grid would not appear red. This is what is meant by implicit styles – the style is assigned to all controls of a particular type. Inherited controls would also inherit the style.


See Also

Using the ImplicitStyleManager