【发布时间】:2017-12-29 07:45:08
【问题描述】:
我有以下边框:
<Border CornerRadius="10,10,0,0" Height="23"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderBrush="DarkBlue"
BorderThickness="1"
Background="AntiqueWhite">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<Image Source="/Resources/Info_48.png"
Height="20"
Width="20"
Stretch="Fill"/>
<TextBlock Width="90"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Background="Transparent"
FontSize="12">
<Run Text="This is a Popup simulation"/>
</TextBlock>
</StackPanel>
</Border>
显示面板时,此边框可见。一旦边框和子组件显示出来,它们将在鼠标点击窗口中的任何位置时自动隐藏。
我要做的是检测边框及其子组件之外的鼠标单击事件。一旦在外面检测到点击,我需要在 StaysOpen=false 时隐藏边框及其子组件,类似于弹出窗口,并且在鼠标点击时自动隐藏。
如何检测控件外的鼠标点击?
【问题讨论】:
标签: c# wpf xaml .net-3.5 border