0

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.

1 Answer 1

1

Try to remove the AncestorLevel property, it's error prone and usually not necessary

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.