Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从代码运行对话框?_C#_Wpf_Xaml_Material Design - Fatal编程技术网

C# 如何从代码运行对话框?

C# 如何从代码运行对话框?,c#,wpf,xaml,material-design,C#,Wpf,Xaml,Material Design,我正在使用材质设计编写一个c#应用程序 以下是我的UserControl的xaml代码: <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.o

我正在使用材质设计编写一个c#应用程序

以下是我的UserControl的xaml代码:

<UserControl
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:MediCare"
         xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" x:Name="Usc1" "
         mc:Ignorable="d" Height="900" Width="600">
<materialDesign:DialogHost x:Name="Dialog" >
    <materialDesign:DialogHost.DialogContent>
        <Grid Width="300" Height="100">
            <TextBlock Text="DIALOG TEST"/>
            <Button Command="{x:StaticmaterialDesign:DialogHost.CloseDialogCommand}" Content="CloseDialog"/>
        </Grid>
    </materialDesign:DialogHost.DialogContent>
    <Grid>
          <Button Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}" Content="CloseDialog" />
    </Grid>
</materialDesign:DialogHost>

我使用
dialog.IsOpen=true获得了要显示的对话框

DialogHost.Show()
?我在DialogHost属性和方法中搜索,没有.Show()或.open()。运行()!我已经试过了,但是没有显示出来,因为就在对话框之后。IsOpen=true;我用来清洁窗户的说明xD这就是为什么我认为它不起作用。。。谢谢,先生:')