<Grid x:Name="LayoutRoot">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="Button" Width="112" Height="50" Visibility="{Binding IsFocused, ElementName=textBox1,Converter={StaticResource MyConverter1}}"/>
</StackPanel>
<TextBox Height="57" HorizontalAlignment="Left" Margin="144,103,0,0" Name="textBox1" VerticalAlignment="Top" Width="98" />
<TextBox Height="57" HorizontalAlignment="Left" Margin="277,103,0,0" x:Name="textBox2" VerticalAlignment="Top" Width="88" />
<TextBox Height="57" HorizontalAlignment="Left" Margin="390,103,0,0" x:Name="textBox3" VerticalAlignment="Top" Width="87" />
</Grid>
使用上面的代码,我可以得到以下结果。
如果单击textBox1按钮将同时隐藏,我单击textBox2和textBox3按钮将隐藏。
我需要的是,每当我点击textBox1和texBox3时,按钮应该是隐藏的。我的意思是上面的线,
<Button Content="Button" Width="112" Height="50" Visibility="{Binding IsFocused, ElementName=textBox1 or textBox3,Converter={StaticResource MyConverter1}}"/>
这可能吗 ?