From my understanding of attached properties, I believe that I can set a property value that will apply to all of the children of a container that match the type. For instance, if I have a number of TextBoxes in a StackPanel, then I can disable them all by setting the TextBox.IsEnabled property to false in the StackPanel's declaration:
<StackPanel TextBox.IsEnabled="False" Orientation="Horizontal">
...
</StackPanel>
I tried this in Visual Studio, and the Xaml designer greyed-out the TextBoxes in the StackPanel exactly as expected, but when I tried to compile, I ran into the error:
The attachable property 'IsEnabled' was not found in type 'TextBox'
Have I misunderstood attached properties? Do they only go from the ancestor to the child? If so, is there a way to do what I am trying, ie, to set all child TextBox
es IsEnabled
property to false?
Thanks for any pointers