Expander in WPF using VB.NET

In this article you will learn how to create a Expander in WPF.
  • 2163
Expander has extra facility to expand content as compare to GroupBox. Expander wraps a region of content and By clicking a small arrow button user can show or hide the content. The IsExpanded property determines if the panel is expanded or not. ExpandDirection is used to make the content expanded behaviour. You can use the four Directions, Down, Up, Right and Left to change the Expanded direction of the content. Expander is frequently used in online help and on web pages to include large amounts of content without overwhelming users with information they don't want to see.

Example of GroupBox

<
Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <Expander Margin="5" Padding="5" Header="Form 1">
            <Button Padding="3">Click to open form 1</Button>
        </Expander>
 
       <Expander Margin="5" Padding="5" Header="Form 2" >
            <TextBlock TextWrapping="Wrap">
Sorry for inconvience, form is under process...
           
</TextBlock>
        </Expander>
        <Expander Margin="5" Padding="5" Header="Form 3">
            <Button Padding="3">Click to open form 3</Button>
        </Expander>
        <Expander Margin="5" Padding="5" Header="Form 4">
            <Button Padding="3">Click to open form 4</Button>
        </Expander>
    </StackPanel>
</
Window>

OUTPUT

expender.gif 

CONCLUSION

Hope this article help you to understand about Expander in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.