tags:

views:

128

answers:

2

I just want to enable or disable the button inside a ControlTemplate for a WPF Editor that I'm using.

+3  A: 

You really shouldn't be doing that explicitly, but instead be setting it with Triggers in the ControlTemplate itself. These Triggers would be reacting to some other change, and would set the Enabled property of the Button.

Joel B Fant
+1  A: 

I agree with Joel that the preferred method would be to trigger the setting of the button's Enabled property with xaml markup, either through a trigger or by binding the Enabled value to another dependency property, possibly on a parent element, likely with the help of a ValueConverter.

However, if you have to do it explicitly in C#, you can use the FindName() method on the template property of the button. There's an MSDN 'how to' linked here.

Shane Arney