Grid c set of columns and columns - they are created dynamically (the user enters their number and columns and columns are programmatically created.), Respectively, they have no names. Those. How to remove a column programmatically in a grid knowing its number?

  • If you need to add / remove columns, the Grid not the most convenient container. Better take something derived from ItemsControl and manage through ItemsSource . - VladD
  • Describe the entire task already. What do you want to do, and here you are already advised on which framework to do it better - Donil
  • Well, I need to do something like chess, only the size of the board (number of cells) will be indicated by the user, and the cells themselves will have the shape of an 8-gon. The width and height of the field will not exceed 100 elements. So I decided to initially create XAML markup in the grid to create 100 columns and 100 lines, in each field to put on the drawn 8-gon and 8 other squares to place the figures. Next, I want that when the user enters the number of columns and rows of the playing field for him, then delete unnecessary lines and stolbtsy along with the contents. - shc345

1 answer 1

Here so:

 Наш_Grid.RowDefinitions.RemoveAt(index); 
  • Try to write more detailed answers. Explain what is the basis of your statement? - Nicolas Chabanovsky