I am just starting to program in c# and I don't understand if I really have a problem with the syntax or with WPF, I want to change the text of the button, but I can't do it, if someone can help me, I would appreciate it.
public MainWindow()
{
InitializeComponent();
Grid mainGrid = new Grid();
this.Content = mainGrid;
Button BTN = new Button();
BTN.Width = 175;
BTN.Height = 23;
BTN.Margin = new Thickness(0, -30, 0, 0);
BTN.Click += BTNclick;
WrapPanel BTNwrap = new WrapPanel();
TextBlock BTNtext = new TextBlock();
BTNtext.Text = "Click";
BTNwrap.Children.Add(BTNtext);
BTN.Content = BTNwrap;
mainGrid.Children.Add(BTN);
}
private void BTNclick(object sender, RoutedEventArgs e)
{
//BTNtext.Text = "Clicked!";
}