Extended Library for WPF and Silverlight | ComponentOne
In This Topic
    Adding a Control to the Header
    In This Topic

    The C1Expander control's header element is able to accept a Silverlight control. In this topic, you will add a Button control to the header in XAML and in code.

    In XAML

    To add a Button control to the header in XAML, place the following XAML markup between the <c1ext:C1Expander> and </c1ext:C1Expander> tags:

    XAML
    Copy Code
    <c1ext:C1Expander.Header>
    <Button Content="Button" Height="Auto" Width="50"/>
    </c1ext:C1Expander.Header>
    

     

    In Code

    To add a Button control to the header in code, complete the following steps:

    1. Add x:Name="C1Expander1" to the <c1ext:C1Expander> tag so that the control will have a unique identifier for you to call in code. 
    2. Enter Code view and add the following code beneath the InitializeComponent() method:

    Visual Basic
    Copy Code
    'Create the Button control
    Dim NewButton As New Button()
    NewButton.Content = "Button"
    'Set the Button Control's Width and Height properties
    NewButton.Width = 50
    NewButton.Height = Double.NaN
    'Add the Button to the header
    C1Expander1.Header = (NewButton)
    

    C#
    Copy Code
    //Create the Button control
    Button NewButton = new Button();
    NewButton.Content = "Button";
    //Set the Button Control's Width and Height properties
    NewButton.Width = 50;
    NewButton.Height = Double.NaN;
    //Add the Button to the header
    C1Expander1.Header = (NewButton);
    

     

    1. Run the program.

     This Topic Illustrates the Following:

    As a result of this topic, a Button control will appear in the header. The final result will resemble the following image: