WPF RelativeSource绑定问题

时间:2009-08-18 09:45:50

标签: wpf binding relativesource

HI! 我有一个Expander和一个TextBox。 我希望在展开扩展器时禁用TextBox,并在未扩展时启用它。 怎么做?我尝试过这样的事情:

<TextBox IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Expander}, AncestorLevel=1},Path=IsExpanded}" />

但反之亦然。

1 个答案:

答案 0 :(得分:1)

尝试删除AncestorLevel属性,它容易出错,通常没必要

相关问题