我正在嘗試使用材料設計制作 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>我該如何修復它?
3 回答

米脂
TA貢獻1836條經驗 獲得超3個贊
嘗試添加以下內容:
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />

桃花長相依
TA貢獻1860條經驗 獲得超8個贊
首先檢查您的項目資源,確保您擁有 Material Design 的核心資源。將此代碼添加到您的 App.Xaml 文件中;在應用程序.資源下。這個對我有用。 <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />

梵蒂岡之花
TA貢獻1900條經驗 獲得超5個贊
您需要將其放在您的 xaml 文件的頂部,您想要放置具有樣式materialdesignfloatinghint樣式的文本框
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
- 3 回答
- 0 關注
- 238 瀏覽
添加回答
舉報
0/150
提交
取消