-2

I have a button that is displayed after a certain event is passed but it isn't created in the main window. How do I add a definition to that button so that it can handle a click event? ie:

        if (something == true)
        {
            Button Button = new Button();
            Button.Height = Y;
            Button.Width = X;
            Save.Margin = new Thickness(XX, YY, 0, 0);
            MyThing.Children.Add(button);
        }

1 Answers1

-1
Button.Click += delegate {
    // Do something
}
Arsen Mkrtchyan
  • 49,896
  • 32
  • 148
  • 184