Home > DeveloperSection > Articles > WrapPanel in WPF

WrapPanel in WPF

0 Comment(s)
 6788  View(s)
Rate this:

WrapPanel in WPF

A WrapPanel element in XAML is used to create a WrapPanel control in WPF. WrapPanel control is similar to StackPanel control in functionality with one difference that WrapPanel control has built in Wrap functionality that means if the child control in WrapPanel is overflow then it is automatically arrange in next line as sequence. In the following demonstration I will told you that how to use WrapPanel control in WPF.

A XAML code snippet representing WrapPanel in WPF

<WrapPanel x:Name="wrapPanel1" Background="Beige" Orientation="Horizontal" >

            <Ellipse Width="100" Margin="10" Height="100" x:Name="ellipse1" Fill="Red"  />

            <Ellipse Width="100" Height="100" Fill="Pink" x:Name="ellipse2" Margin="10" />

            <Ellipse Width="100" Height="100" Fill="Orange" x:Name="ellipse3" Margin="10" />

            <Ellipse Width="100" Height="100" Fill="Green" x:Name="ellipse4" Margin="10" />

            <Ellipse Width="100" Height="100" Fill="Cyan" x:Name="ellipse5" Margin="10" />

            <Ellipse Width="100" Height="100" Fill="Goldenrod" x:Name="ellipse6" Margin="10" />

            <Ellipse Width="100" Height="100" Fill="Teal" x:Name="ellipse7" Margin="10" />

            <Ellipse Width="100" Height="100" Fill="Aquamarine" x:Name="ellipse8" Margin="10" />


Output of the following code snippet is as follows

WrapPanel in WPF

WrapPanel in WPF


Don't want to miss updates? Please click the below button!

Follow MindStick