我正在嘗試使用材料設(shè)計(jì)制作 UI,但是當(dāng)我想使用它時(shí)出現(xiàn)錯(cuò)誤:無(wú)法解析資源“MaterialDesignFloatingHintTextBox”。https://ibb.co/PcvdmqH錯(cuò)誤看起來(lái)如何我從 NuGet MaterialDesignThemes 安裝,我導(dǎo)入了這個(gè) xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"在 App.xaml 中我這樣寫(xiě):<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>我該如何修復(fù)它?
3 回答

米脂
TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超3個(gè)贊
嘗試添加以下內(nèi)容:
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBox.xaml" />

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

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