当前位置:网站首页>Wpf: solve the problem that materialdesign:dialoghost cannot be closed
Wpf: solve the problem that materialdesign:dialoghost cannot be closed
2022-07-03 07:59:00 【Ocean on the other side】
Use MaterialDesion Development WPF Applications : Make a pop-up effect with a mask :
DialogHost.Show

As shown in the figure above : Click on “ determine ” Button to close pop-up window ;
The binding command of the close button is as follows :
<Button IsDefault="True" Style="{StaticResource MaterialDesignFlatButton}"
Width="160" Height="40" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Content=" determine "></Button>If you want to close the pop-up window in the background :
Using the following wording may not take effect :
DialogHost.CloseDialogCommand.Execute(null, null);
I changed my mind and solved the problem :
var session = DialogHost.GetDialogSession(ROOT_DIALOG_ID);
if (session == null)
{
return;
}
session.Close();Empathy : If you need to update the display of the pop-up window during the pop-up process , have access to session.Update();
for example :
/// <summary>
/// Pop up tips , User self closing
/// </summary>
/// <param name="text"></param>
public static void PopHint(string text)
{
var dialog = new PopMessageBoxe
{
Message = { Text = text }
};
var session = DialogHost.GetDialogSession(ROOT_DIALOG_ID);
if (session == null)
{
DialogHost.Show(dialog, ROOT_DIALOG_ID, ExtendedOpenedEventHandler);
}
else
{
session.UpdateContent(dialog);
}
}
边栏推荐
- [global product discovery 2] the first pure cloud augmented reality (AR) platform - Israel
- idea取消引用顯示效果
- register关键字
- Retail philosophy retail psychological warfare after reading -- 7-11 is a good product!
- What does (+) in Oracle mean
- Product creation and commercial realization of chat robot (according to La Ma Bang - Dr. Wang Jingjing - speech)
- 2020-12-12
- Wechat applet taro learning record
- 华为S5700交换机初始化和配置SSH和TELNET远程登录方法
- Unity performance optimization
猜你喜欢

Redis批量启停脚本

Oracle queries grouped by time

方正锐利重磅升级到12.0版本,包装印前处理更加便捷、高效!

unity2019_ Input management

EtherCAT state machine transition (ESM)

My touch screen production "brief history" 2

Iterm2 setting
![[MySQL 12] MySQL 8.0.18 reinitialization](/img/e1/9874df18bbc8d80c3c5c5fe39aefc9.png)
[MySQL 12] MySQL 8.0.18 reinitialization

Free use until 2015 -- viz artist multi touch plug-in package

the installer has encountered an unexpected error installing this package
随机推荐
[at] ABC 258g - triple Reach - violence
the installer has encountered an unexpected error installing this package
在浏览器输入url后执行什么
I want to do large screen data visualization application feature analysis
Idea dereference display effect
链式长取值
P2704 [NOI2001] 炮兵阵地(状压dp)
Ventuz Foundation Series "one step at the door"
Redis batch startup and shutdown script
Huawei switch basic configuration (telnet/ssh login)
[at] abc 258G - Triangle 三元组可达-暴力
[MySQL 12] MySQL 8.0.18 reinitialization
一条通往服务器所有端口的隧道
Quality blog——
tslib库的移植
static关键字
Redis批量启停脚本
An intern's journey to cnosdb
register关键字
s7700设备如何清除console密码