There is a ComboBox, in it the dimensions of the matrix are from 2 to 10. How to realize that when choosing the size (from СomboBox) a matrix is formed with the dimension equal to the selected value from the ComboBox, and columns and rows of the required size that could be filled out are automatically displayed. WPF is studying for a couple of days and could only make a drop-down list.
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApplication1" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"> <Canvas> <ComboBox Margin="10 10 0 0" ItemsSource="{Binding Count}" SelectedIndex="0" MinWidth="40" HorizontalAlignment="Center" VerticalAlignment="Center"> </ComboBox> </Canvas> </Window> public partial class MainWindow : Window { public int[] Count { get; private set; } private const int Min = 2; private const int Max = 10; public MainWindow() { InitializeComponent(); Count = Enumerable.Range(Min, Max - Min + 1).ToArray(); DataContext = this; } }