-2

I'm trying to change the text in a button when said button is clicked. how would I go about doing that (I've been seeing many varying answers)?

the Error is: Error 16 'System.Windows.Controls.Button' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'System.Windows.Controls.Button' could be found (are you missing a using directive or an assembly reference?)

if (Result == MessageBoxResult.Yes)
{
    MessageBox.Show("You Reserved this seat");
    btnSeat1.Text = "Reserved";
}
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179
Nathan
  • 61
  • 1
  • 2
  • 6

1 Answers1

3

WinForms buttons have Text, WPF buttons (System.Windows.Controls.Button) have Content

Text is a string, Content can be very complex (link)

so change you code to:

btnSeat1.Content = "Reserved";
ASh
  • 34,632
  • 9
  • 60
  • 82