0

in my xaml file i have 5 buttons i want to disable all except one

how i can do this

note : my Buttons in three StackPanels so i can't use this answer question

this code give me compile error

foreach (Control ctrl in this.Controls)
    ctrl.Enabled = false;

CancelButton.Enabled = true;
Community
  • 1
  • 1
Tarek Saied
  • 6,482
  • 20
  • 67
  • 111

1 Answers1

2

A bit more info perhaps? One way of doing is to bind IsEnabled property of all buttons that you want to control, to a public property in the "code behind", and then set its value when needed.

IsEnabled={Binding Path=IsEnabledProperty}

Something like that, I can't be more specific at the moment, cos I'm not on my work computer, but I'm sure someone will come up with a propper example ;)

H H
  • 263,252
  • 30
  • 330
  • 514
Franz1986
  • 134
  • 2
  • 7