I am working on WPF application.I have bound my textblock to my button. I want to set foreground of my textblock to black color when its associated button\'s isEnabled is tr
The answer above shows you how to correctly you use a converter. However, do you really need to use a converter? This can be done in XAML only using Triggers:
XAML
In the example above, the first TextBlock binds to its parent's IsEnabled property using a DataTrigger, and sets the Foreground to some colour if it is true.
However, this is overkill - the IsEnabled property is propagated down to children automatically by WPF. That is, if you set IsEnabled to false on your Button, then your TextBlock will have its IsEnabled property updated to false automatically. This is demonstrated in the second TextBlock which uses a property Trigger to check its own IsEnabled property against the value of true (since its IsEnabled property will be the same as its parent's). This would be the preferred approach.
Hope this helps!