Reputation: 12283
HI! I have an Expander and a TextBox. I want to disable the TextBox when the Expander is expanded and enable when it's not expanded. How to do that? I've tried something like this:
<TextBox IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Expander}, AncestorLevel=1},Path=IsExpanded}" />
But it's vice versa.
Upvotes: 0
Views: 2333
Reputation: 292355
Try to remove the AncestorLevel property, it's error prone and usually not necessary
Upvotes: 1