title: WPF MaterialDesign Dialog Host
body: <p>I am building a WPF application and I would like to have custom MessageBox but I saw that is really tedious and I thought of using the DialogHost provided by MaterialDesign. The problem is that I can't get it to work the way I want it to so let me describe the current behaviour and the wanted one.</p>
  <p>The current behaviour:</p>
  <pre><code>&lt;materialDesign:ColorZone Grid.Column=&quot;1&quot;
                                    Grid.ColumnSpan=&quot;2&quot;
                                    Grid.Row=&quot;1&quot;
                                    Mode=&quot;Light&quot;
                                    Padding=&quot;16&quot;&gt;
              &lt;DockPanel&gt;
                  &lt;materialDesign:DialogHost DockPanel.Dock=&quot;Right&quot;&gt;
                      &lt;Button x:Name=&quot;PowerButton&quot;
                              ToolTip=&quot;{Binding PowerButtonToolTip, Source={StaticResource ResourceKey=ButtonsResources}}&quot;
                              Style=&quot;{StaticResource MaterialDesignIconButton}&quot;
                              Command=&quot;{x:Static materialDesign:DialogHost.OpenDialogCommand}&quot;&gt;
                          &lt;Button.CommandParameter&gt;
                              &lt;StackPanel&gt;
                                  &lt;TextBlock Text=&quot;TODO&quot; /&gt;
                                  &lt;StackPanel Orientation=&quot;Horizontal&quot;
                                              Margin=&quot;0, 20, 0, 10&quot;&gt;
                                      &lt;Button Width=&quot;90&quot;
                                              Height=&quot;30&quot;
                                              Margin=&quot;10, 0, 0, 0&quot;
                                              Style=&quot;{StaticResource MaterialDesignOutlinedButton}&quot;
                                              Click=&quot;PowerButton_Click&quot;&gt;
                                          OK
                                      &lt;/Button&gt;
                                      &lt;Button Width=&quot;90&quot;
                                              Height=&quot;30&quot;
                                              Margin=&quot;10, 0, 10, 0&quot;
                                              Style=&quot;{StaticResource MaterialDesignOutlinedButton}&quot;
                                              Command=&quot;{x:Static materialDesign:DialogHost.CloseDialogCommand}&quot;&gt;
                                          CANCEL
                                      &lt;/Button&gt;
                                  &lt;/StackPanel&gt;
                              &lt;/StackPanel&gt;
                          &lt;/Button.CommandParameter&gt;
                          &lt;materialDesign:PackIcon Kind=&quot;Power&quot; /&gt;
                      &lt;/Button&gt;
                  &lt;/materialDesign:DialogHost&gt;
                  &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
                      &lt;ToggleButton x:Name=&quot;MenuButton&quot;
                                    Style=&quot;{DynamicResource MaterialDesignHamburgerToggleButton}&quot; /&gt;
                      &lt;TextBlock VerticalAlignment=&quot;Center&quot;
                                 Margin=&quot;16 0 0 0&quot;
                                 Text=&quot;{Binding MainViewTitle, Source={StaticResource ResourceKey=ViewsResources}}&quot;&gt;
                      &lt;/TextBlock&gt;
                  &lt;/StackPanel&gt;
              &lt;/DockPanel&gt;
          &lt;/materialDesign:ColorZone&gt;
  </code></pre>
  <p>What happens is that when I'm clicking the PowerButton the DialogHost appears with the structure from the Button.CommandParameter. The issue with this is that the window doesn't get &quot;disabled&quot; (getting a little black and unclickable) while the dialogue is on.</p>
  <p>I saw that to achieve this behaviour I need to but all the content of the window inside the DialogHost. But is it really so or I am misunderstanding something? Their example (<a href="https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MainDemo.Wpf/Dialogs.xaml" rel="nofollow noreferrer">see link</a>) isn't really helpful because there seem to be other things running in the background. Moreover, the command materialDesign:DialogHost.OpenDialogCommand of the button that is opening the &quot;Topmost dialogue host&quot; seems limited to me.</p>