Let's look at a simple example to add a few buttons in WrapPanel. Perform the following steps to design the UI:
- From the Visual Studio Solution Explorer, open the MainWindow.xaml page.
- Replace the existing Grid panel with a WrapPanel control and set its Orientation property to Horizontal.
- Add a few button controls of diverse sizes. The entire XAML inside the window will look like the following code:
<WrapPanel Orientation="Horizontal"> <Button Content="Button 1" Margin="4" Width="100" Height="30"/> <Button Content="Button 2" Margin="4" Width="100" Height="30"/> <Button Content="Button 3" Margin="4" Width="100" Height="30"/> <Button Content="Button 4" Margin="4" Width="208" Height="30"/> <...