Expander control WPF in VB.NET

This article defines how to use expander control in xaml.
  • 3942

This article defines the expander control with RadioButton control in XAML.

Expander control

The Expander control is like a GroupBox but with the additional feature to collapse and expand its content. we see in some website which provides functionalty to close and open some controls. This can be achieved in WPF using the Expander control.

For example

This example defines the Expander control with collapse and expand. To do that we Create four RadioButton in xaml to show collapse and expand.

XAML code

<Expander Header="Expander1" Height="117" HorizontalAlignment="Left" Margin="10,10,0,0" Name="Expander1" VerticalAlignment="Top" Width="258" IsExpanded="False" Background="Aqua">

            <Grid Height="119">

                <RadioButton Content="RadioButton" Height="16" HorizontalAlignment="Left" Margin="10,6,0,0" Name="RadioButton1" VerticalAlignment="Top" />

                <RadioButton Content="RadioButton" Height="16" HorizontalAlignment="Left" Margin="10,24,0,0" Name="RadioButton2" VerticalAlignment="Top" />

                <RadioButton Content="RadioButton" Height="16" HorizontalAlignment="Left" Margin="10,46,0,0" Name="RadioButton3" VerticalAlignment="Top" />

                <RadioButton Content="RadioButton" Height="16" HorizontalAlignment="Left" Margin="10,68,0,0" Name="RadioButton4" VerticalAlignment="Top" />

            </Grid>

        </Expander>

Now run the application and test it.

 ex1.gif

Figure1.gif

Now click on the expander control. This looks like this.

ex2.gif

Figure2.gif

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.