在我的主窗口 xaml 中,我有两个用户控件和两个RadioButton
s. 我希望RadioButton
s 控制Visibility
用户控件的。
xml摘录:
<WpfApp2:ViewTree/>
<WpfApp2:ViewTab/>
<RadioButton x:Name="radioButton_Tree" GroupName="View"
IsChecked="True"> Tree View </RadioButton>
<RadioButton x:Name="radioButton_Tab" GroupName="View"
IsChecked="False" >Tab View</RadioButton>
在用户控件中,我有这样的东西:
Visibility="{Binding IsChecked,
Converter={StaticResource BooleanToVisibilityConverter},
ElementName=Window1.radioButton_Tree}" >
在运行时我收到此错误:
Cannot find source for binding with reference 'ElementName=Window1.radioButton_Tab'
我在看什么?