wpf 如何从代码 (.xaml.cs) 打开材料设计对话框?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49965223/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 14:10:24  来源:igfitidea点击:

How to open a material design dialog from the code (.xaml.cs)?

c#wpfxamlmaterial-design

提问by Lotfi

i'm coding a wpf application using material design

我正在使用材料设计编写 wpf 应用程序

i've a DialogHostnamed dialog and i want to open and show its content from the code (.xaml.cs), in XAML the command is Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"but i sought in DialogHost properties and methods and i didn't find anything...

我有一个DialogHost命名对话框,我想从代码 (.xaml.cs) 中打开并显示其内容,在 XAML 中,命令是Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}"但我在 DialogHost 属性和方法中寻找,但没有找到任何东西...

回答by Saad Lembarki

Simply you can use this :

你可以简单地使用这个:

view.IsOpen = true;