根 DialogHost 给出一个空白 window
Root DialogHost giving a blank window
我想为多个对话框设置根 DialogHost。问题是它使 window 空白。我看了演示,无法弄清楚我做错了什么。创建了一个简单的应用程序,只有 Material Design Nuget 和对话框;
<Window x:Class="DailogTest2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DailogTest2"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<materialDesign:DialogHost Identifier="RootDialog" >
<DockPanel>
<TextBlock Text="Amazing Program!" FontSize="48" FontWeight="Bold" Margin="50"/>
</DockPanel>
</materialDesign:DialogHost>
</Window>
这个returns一个空白window。我知道这很简单,但我想不通。
当我将您的代码复制到示例项目中时,它显示了文本框。
你的 App.xaml 正确吗?对于 xaml 2.6.0 中的 materialdesign 你必须使用这种语法,因为 wiki 中的那个只适用于 3.0,它仍然只是一个预览版本。
<Application blablabla>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Purple.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
我想为多个对话框设置根 DialogHost。问题是它使 window 空白。我看了演示,无法弄清楚我做错了什么。创建了一个简单的应用程序,只有 Material Design Nuget 和对话框;
<Window x:Class="DailogTest2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DailogTest2"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<materialDesign:DialogHost Identifier="RootDialog" >
<DockPanel>
<TextBlock Text="Amazing Program!" FontSize="48" FontWeight="Bold" Margin="50"/>
</DockPanel>
</materialDesign:DialogHost>
</Window>
这个returns一个空白window。我知道这很简单,但我想不通。
当我将您的代码复制到示例项目中时,它显示了文本框。 你的 App.xaml 正确吗?对于 xaml 2.6.0 中的 materialdesign 你必须使用这种语法,因为 wiki 中的那个只适用于 3.0,它仍然只是一个预览版本。
<Application blablabla>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Purple.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>