Basic Library for WPF and Silverlight | ComponentOne
WPF and Silverlight Edition Basic Library / HeaderedContentControl / C1HeaderedContentControl Elements / C1HeaderedContentControl Header
In This Topic
    C1HeaderedContentControl Header
    In This Topic

    By default, the C1HeaderedContentControl's header bar contains no text. To add text to the header bar, simply set the Header property to a string. Once the text is added, you can style it using several font properties (see Text Properties You can also add different controls to the header. For task-based help about adding content to the header, see Adding Content to the Header Bar.

    You can adjust the padding of the header using the C1HeaderedContentControl's HeaderPadding property.

    Attribute Syntax versus Property Element Syntax

    When you want to add something simple to the C1HeaderedContentControl header, such as an unformatted string, you can simply use the common XML attributes in your XAML markup, such as in the following:

    <c1:C1HeaderedContentControl Header="Hello World"/>
    

     

    However, there may be times where you want to add more complex elements, such as grids or panels, to the content panel. In this case you would use property element syntax, such as in the following:

    XAML
    Copy Code
    <c1:C1HeaderedContentControl Width="150" Height="55" Name="C1HeaderedContentControl1">
        <c1:C1HeaderedContentControl.Header>
            <Grid HorizontalAlignment="Stretch">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="C1HeaderedContentControl Header" />
            </Grid>
        </c1:C1HeaderedContentControl.Header>
    </c1:C1HeaderedContentControl>