我试图用材料设计来创建一个UI,但是当我想使用它时,我有一个错误:资源“MaterialDesignFloatingHintTextBox”无法被解析。
https://ibb.co/PcvdmqH错误是什么样子?
我从NuGet MaterialDesignThemes安装了这个xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
我在App.xaml上写道:
<ResourceDictionary x:Key="MaterialDesign">
<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.Indigo.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>我怎么才能修好它?
发布于 2019-10-01 21:27:56
您需要将它放在xaml文件的顶部,在该文件中,您希望将带有样式的textbox (材料设计浮点数样式)放在其中。
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes“
发布于 2019-12-05 14:32:05
还尝试添加以下内容:
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />发布于 2021-10-22 15:13:57
首先检查你的项目资源,看看你是否有材料设计的元素。将此代码添加到App.Xaml文件中;在Application.Resources下面。对我来说很管用。<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
https://stackoverflow.com/questions/58154489
复制相似问题