当前位置:网站首页>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);
}
}
边栏推荐
- Microsoft Security Response Center
- Structure of golang
- PostGIS space function
- How to clear the console password for s7700 device
- [global product discovery 2] the first pure cloud augmented reality (AR) platform - Israel
- Introduction of novel RNA based cancer therapies
- [untitled]
- 一个实习生的CnosDB之旅
- Luaframwrok handles resource updates
- 一篇文章让你读懂-曼彻斯特编码
猜你喜欢

Pat class a 1030 travel plan

Technical dry goods Shengsi mindspire dynamic transformer with variable sequence length has been released!

IP production stream is so close to me

Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does

什么是数据类型?数据类型有什么用?

Harmonyos third training notes

PostGIS space function

My touch screen production "brief history" 1

Pat class a 1028 list sorting

LwIP learning socket (application)
随机推荐
Mutual call between Lua and C #
Huawei s5700 switch initialization and configuration Telnet, SSH user methods
[at] ABC 258g - Triangle triples reachable - violence
[MySQL 11] how to solve the case sensitive problem of MySQL 8.0.18
MaxCompute字符串分割函数-SPLIT_PART
P2622 关灯问题II(状态压缩 搜索)
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
[at] abc 258G - Triangle 三元組可達-暴力
Screenshot tool snipaste
What is a data type? What is the use of data types?
Usage of (case, when) in PostgreSQL
s7700设备如何清除console密码
华为交换机基础配置(telnet/ssh登录)
Worldview satellite remote sensing image data / meter resolution remote sensing image
Uniapp learning records
璞华PLM为全场景产品生命周期管理赋能,助力产品主线的企业数字化转型
[at] abc 258G - Triangle 三元组可达-暴力
Structure of golang
Harmonyos third training notes
一篇文章让你读懂-曼彻斯特编码