У меня есть следующий XAML, который отображает четыре кнопки в одном ряду по горизонтали.
Как сделать так, чтобы отображалось три кнопки в строке и столько строк, сколько необходимо?
XAML
<ItemsControl ItemsSource="{Binding DataButtons}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="20"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="100" Height="100"
Content="{Binding ButtonName}"
Command="{Binding ButtonCommand}"
CommandParameter="{Binding FilePath}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Что я получаю сейчас
![enter image description here](https://i.stack.imgur.com/xvAau.png)
Что мне нужно
![enter image description here](https://i.stack.imgur.com/Iiu4E.png)