My WPF button needs to change the Content of a different button

99 Views Asked by At

I have 2 WPF buttons...when I click on one, I want the Content of the other button to change. Right now, when I click on btn1, the btn2 Content does not change.

I have attempted a btn2.InvalidateVisual() but no help

private void btn1_Click(object sender, RoutedEventArgs e)  
{
    count++; //count is a global int
    btn2.Content = string.Format("Btn 1 was clicked {0} times",count);
}
1

There are 1 best solutions below

1
EricW On

As Klaus Gütter says. The code is ok. There have to be another problem. Show us your XAML.