I want to rotate the button when clicking. I thought that should work like this:
void new_button_click(object sender, RoutedEventArgs e) { Button btn = sender as Button; var transform = btn.RenderTransform as RotateTransform; transform.Angle += 90; } But it does not work)) What's wrong? I want to implement a rotation using C # code, not XAML. When clicking, swears at this line:
transform.Angle += 90; An exception:
The object reference does not indicate an object instance.