ContentControl styles and templates

Applies to Windows and Windows Phone

This topic describes the styles and templates for the ContentControl control. You can modify these resources and the default ControlTemplate to give the control a unique appearance.

Visual states

The ContentControl default style doesn't define any visual states.

Theme resources

The ContentControl default style doesn't use any theme resources.

For more info on theme resources, including the values that are used for the HighContrast theme, see XAML theme resources reference.

Default style


<!-- Default style for Windows.UI.Xaml.Controls.ContentControl -->
<Style TargetType="ContentControl">
    <Setter Property="HorizontalContentAlignment" Value="Left"/>
    <Setter Property="VerticalContentAlignment" Value="Top"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ContentControl">
                <ContentPresenter Content="{TemplateBinding Content}"
                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                  Margin="{TemplateBinding Padding}"
                                  ContentTransitions="{TemplateBinding ContentTransitions}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

 

 

Show:
© 2014 Microsoft. All rights reserved.