Adding a Control to the Content Panel
The C1Expander control will accept one child control in its content panel. In this topic, you will add learn how to add a WPF button control in the Properties window, in XAML, and in code.
At Design Time
To add a control to the content panel, complete the following steps:
1. Click the C1Expander control once to select it.
2. In the Toolbox, double-click the Button icon to add a Button control the content panel of the C1Expander control.
3. Run the program and then expand the C1Expander control.
In XAML
To add a button control to the C1Expander control's content panel in XAML, complete the following steps:
1. Place the following markup between the <c1ext:C1Expander> and </c1ext:C1Expander> tags:
<Button Content="Button" Height="Auto" Width="Auto"/>
2. Run the program and then expand the C1Expander control.
In Code
To add a button control to the C1Expander control's content panel in code, complete the following:
1. Enter Code view and add the following code beneath the InitializeComponent() method:
'Create the Button control
Dim NewButton As New Button()
NewButton.Content = "Button"
'Set the Button Control's Width and Height properties
NewButton.Width = Double.NaN
NewButton.Height = Double.NaN
'Add the Button to the content panel
C1Expander1.Content = (NewButton)
•C#
//Create the Button control
Button NewButton = new Button();
NewButton.Content = "Button";
//Set the Button Control's Width and Height properties
NewButton.Width = double.NaN;
NewButton.Height = double.NaN;
//Add the Button to the content panel
c1Expander1.Content = (NewButton);
2. Run the program and then expand the C1Expander control.
This Topic Illustrates the Following:
When the C1Expander control is expanded, the button control appears in its content panel and resembles the following image: