Expander Content Panel

The C1Expander control's content panel initially consists of an empty space. In the content panel, you can add grids, text, images, and arbitrary controls. When working in Blend or in Visual Studio's Design view, elements in the content panel of the control can be added and moved on the control through a simple drag-and-drop operation.

The following image labels the content panel of the C1Expander control.

 

 

You can add text to the content panel by setting the C1Expander control's Content property or by adding a TextBox element to the content panel. Adding WPF elements to the content panel at run time is simple: You can either use simple drag-and-drop operations or XAML in Visual Studio or Blend. If you'd prefer to add a control at run time, you can use C# or Visual Basic code.

Content controls like C1Expander can only accept one child element at a time. However, you can get around this limitation by adding a panel-based control as the C1Expander control's child element. Panel-based controls, such as a StackPanel control, are able to hold multiple elements. The panel-based control meets the one control limitation of the C1Expander control, but its ability to hold multiple elements will allow you to show several controls in the content panel. 

Attribute Syntax versus Property Element Syntax

When you want to add something simple to the C1Expander content panel, such as an unformatted string or a single control, you can simply use the common XML attributes in your XAML markup, such as in the following:

 

<c1ext:C1Expander Content="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 can use property element syntax, such as in the following:

 

<c1ext:C1Expander ExpandDirection="Down" Width="150" Height="55" Name="C1Expander1">

            <c1ext:C1Expander.Content>

                <StackPanel>

                    <TextBlock Text="Hello"/>

                    <TextBlock Text="World"/>

                </StackPanel>

            </c1ext:C1Expander.Content>

</c1ext:C1Expander>


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.