Dependency properties can be inherited (see 10th point here), which is a nice feature:
<Grid TextBlock.FontSize="100">
... any TextBlock inside will inherit this value
</Grid>
To make this possible TextBlock
have to use AddOwner()
for an attached property TextElement.FontSize. Setting either attached property (TextBlock or TextElement) will do.
I want to achieve something like:
<Grid local:MyControl.IsEnabled="False">
... somewhere inside MyControl will get disabled
</Grid>
And I am not sure how to achieve it, because IsEnabled
is not attached property (means I can't use above syntax), nor I want to disable all UIElements.
What is the right way to do it? Is it to make new attached property and in its callback change IsEnabled
or something more convenient exists?