【发布时间】:2015-05-22 12:10:00
【问题描述】:
我正在使用 wpf 覆盖通用应用程序中组合框的样式。在 windows 8.1 上一切正常,但在 windows phone 8.1 上我收到错误消息,指出不存在具有键/名称 ComboBoxThemeMinWidth 的资源。
<Application
x:Class="wcc.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:wcc"
RequestedTheme="Dark">
<Application.Resources>
<Style TargetType="ComboBox">
<Setter Property="Padding" Value="8,0" />
<Setter Property="MinWidth" Value="{ThemeResource ComboBoxThemeMinWidth}" />
<Setter Property="Foreground" Value="{ThemeResource ComboBoxForegroundThemeBrush}" />
...
我做错了什么?我所需要的只是组合框的不同样式,但我不知道如何为 windows phone 做到这一点。
【问题讨论】:
-
错误是否发生在设计器中或编译后...有时重新启动 VisualStudio 会有所帮助
-
应用启动时编译后
-
尝试将您的样式放在单独的资源字典文件中,并在您的 App.xaml 文件中使用
MergedDictionaries来引用它。 -
没有变化,仍然出现该错误...
标签: c# wpf combobox win-universal-app