当前位置:网站首页>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);
}
}
边栏推荐
- 什么是定义?什么是声明?它们有何区别?
- WPF:解决MaterialDesign:DialogHost 无法关闭问题
- 方正锐利重磅升级到12.0版本,包装印前处理更加便捷、高效!
- Microsoft Security Response Center
- Redis profile
- Project experience sharing: handwritten Chinese character recognition based on Shengsi mindspire
- Uniapp learning records
- 什麼是定義?什麼是聲明?它們有何區別?
- 使用 FileChannel 进行文件的复制拷贝
- Client server model
猜你喜欢
Research shows that breast cancer cells are more likely to enter the blood when patients sleep
WorldView卫星遥感影像数据/米级分辨率遥感影像
C language learning notes (mind map)
Pat class a 1032 sharing
*p++、*++p、++*p、(*p)++
Pat class a 1028 list sorting
STM32F103 SPI (pit Diary)
Redis batch startup and shutdown script
一个实习生的CnosDB之旅
[MySQL 12] MySQL 8.0.18 reinitialization
随机推荐
VMware virtual machine configuration static IP
C language learning notes (mind map)
WPF:解决MaterialDesign:DialogHost 无法关闭问题
regular expression
Research shows that breast cancer cells are more likely to enter the blood when patients sleep
Pycharm remote ssh pyenv error: pydev debugger: warning: trying to add breakpoint to file that does
[USACO12MAR]Cows in a Skyscraper G(状态压缩dp)
创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
[end of 2021] National Meteorological Short Video (Kwai, Tiktok) influence list in December
[at] abc 258G - Triangle 三元組可達-暴力
MAE
什么是定义?什么是声明?它们有何区别?
Idea unreference Display Effect
[cocos creator] get the resource UUID
What is a data type? What is the use of data types?
I want to do large screen data visualization application feature analysis
Unity XR realizes interaction (grasping, moving, rotating, transmitting, shooting) -pico
The general trend of data news releases the power of visual reporting ----- essays after reading
[cocos creator] Click the button to switch the interface
Install cross compiler arm none liunx gnueabihf