How do I stop inheritance in xaml?
- by cfouche
Hi
Let's say I have some Control that has been disabled. It contains a bunch of elements, but I want one of those child elements to remain enabled.
Something like this:
<ContentControl IsEnabled="False">
<Border>
<Button Content="Button" IsEnabled="True"/>
</Border>
</ContentControl>
So in this example, the Button's IsEnabled="True" setting gets overridden by its parent. Is there a way of stopping this from happening?
This seems like a strange thing to be doing, but I have a situation where, when a Control is disabled and a user mouses down on it, I still want an event to be triggered.
I read in WPF Unleashed that wrapping something in a Frame control, "..isolates the content from the rest of the UI [and] properties that would normally be inherited down the element tree stop when they reach the Frame", but wrapping the Button in the example above in a Frame doesn't work.
Am I on the wrong track here?