gpt4 book ai didi

wpf - 在弹出窗口外单击时如何关闭弹出窗口

转载 作者:行者123 更新时间:2023-12-04 13:08:00 25 4
gpt4 key购买 nike

这是XAML打开弹出窗口的代码 IsChecked btnViewDetail,我需要在点击弹出窗口的一侧关闭弹出窗口。

<Popup IsOpen="{Binding IsChecked, ElementName=btnViewDetail}" PopupAnimation="Fade" Width="300" Height="225" PlacementTarget="{Binding ElementName=svTotalStock}" Placement="Top" StaysOpen="False">
<Grid Background="Black">
<TextBlock TextWrapping="Wrap" Text="Raw Materials details"
VerticalAlignment="Top" Height="25" FontFamily="Segoe UI Semibold"
Padding="7,6,0,0" FontWeight="Bold" FontSize="14" Foreground="White"
Margin="0,2,59,0"/>
<Border BorderThickness="1" BorderBrush="Black"/>
</Grid>
</Popup>
<Grid>
<Grid.ContextMenu>
<ContextMenu>
<MenuItem IsCheckable="True" Name="btnViewDetail" Header="View Details"/>
</ContextMenu>
</Grid.ContextMenu>
</Grid>

最佳答案

Popup 的属性 StaysOpen = false做这项工作。

关于wpf - 在弹出窗口外单击时如何关闭弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34718925/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com