Export (0) Print
Expand All

ContentControl Styles and Templates

Silverlight

This topic describes the styles and templates for the ContentControl control. You can modify the default ControlTemplate to give the control a unique appearance. For more information, see Customizing the Appearance of an Existing Control by Using a ControlTemplate.

The following XAML shows the default style for the ContentControl control


<Style TargetType="ContentControl">
      <Setter Property="Foreground" Value="#FF000000"/>
      <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}"
                      Cursor="{TemplateBinding Cursor}"
                      Margin="{TemplateBinding Padding}"
                      HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                      VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
              </ControlTemplate>
          </Setter.Value>
      </Setter>
  </Style>


Community Additions

ADD
Show:
© 2014 Microsoft