Buttons are generated as follows:
private Button[,] CreateButtons(int quantity) { Form.Rows = quantity; Form.Columns = quantity; Button[,] buttons = new Button[quantity, quantity]; for (int i = 0; i < quantity; i++) { for (int j = 0; j < quantity; j++) { buttons[i, j] = new Button(); buttons[i, j].Width = 100; buttons[i, j].Height = 20; buttons[i, j].Margin = new Thickness(5,80,0,0); buttons[i, j].Click += new RoutedEventHandler(new_button_click); } } return buttons; } And there is an event handler for clicking on them:
void new_button_click(object sender, RoutedEventArgs e) { Button btn = sender as Button; if (btn != null) { var transform = new RotateTransform(90); transform.CenterX = 50; transform.CenterY = 10; btn.RenderTransform = transform; } } How to make it so that when you click on one button, all buttons in one line and in one column are turned.