【发布时间】:2011-04-06 19:42:47
【问题描述】:
示例:
<UserControl x:Name="userControl"
<StackPanel x:Name="container" Margin="0">
<TextBox Text="{Binding Path=SettingValue, RelativeSource={RelativeSource Mode=Self}}"/>
</StackPanel>
</UserControl>
UserControl 包含 SettingValue 依赖属性,TextBox 没有,
所以这个例子行不通。
如果我有 AncestorType,我可以做到这一点,就像在 WPF 中一样:
RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControlType}
是否有可能绑定到 UserControl.SettingValue 属性?
【问题讨论】: