当控制权消失时,弹出窗口保持打开状态
在用户控件网格(Grid1)中,我有一个文本框、两个按钮(搜索和保存按钮)和两个弹出窗口(Popup1 和 Popup2)。 Popup2 内部有一个文本框和一个按钮(搜索)。当用户在 Grid1 外部单击时,我想隐藏弹出窗口(1 和 2)。现在我可以隐藏 Popup,但无法单击 Popup2 内的按钮。一旦我单击 Popup2 内的 SearchButton,它就会隐藏弹出窗口。
我已将两个弹出窗口的 StaysOpen 属性设置为 bool 属性,如下所示: StaysOpen="{Binding PopupStaysOpen}"
谢谢。 -梅农
private void Grid1_LostFocus(object sender, RoutedEventArgs e)
{
(this.DataContext as ViewModel).PopupStaysOpen = false;
}
In a Usercontrol Grid(Grid1) I have a textBox, two Buttons (Search and Save Buttons) and Two Popups(Popup1 and Popup2). Inside Popup2 there is a textBox and one button(Search). I wanted to hide the popups(both 1 and 2) when when the user click outside the Grid1. Rightnow I can hide the Popups but NOT able to click the button inside Popup2. As soon as I Click the SearchButton inside the Popup2 it hides Popups.
I have set the StaysOpen Property for both Popups to a bool prop like this: StaysOpen="{Binding PopupStaysOpen}"
Thanks.
-Menon
private void Grid1_LostFocus(object sender, RoutedEventArgs e)
{
(this.DataContext as ViewModel).PopupStaysOpen = false;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论