【发布时间】:2018-01-18 09:30:39
【问题描述】:
我正在尝试使用某些特定样式设置我的 UWP 应用程序的样式,而在其他平台上它应该保持默认。
这是我的项目布局:
我尝试了以下方法:
在Clients.Shared 中创建如下样式:
<Style x:Key="SomeStyle" TargetType="Button" />
并在 Clients.Themes.UWP 中添加相同的 Style 键,以便它可以覆盖它,但没有运气。
然后我尝试使用虚拟样式并使用onPlatform,但这也不起作用,但我仍然认为这是要走的路。我有以下代码:
<Style x:Key="DummyStyle" TargetType="Button">
<Setter Property="Style">
<Setter.Value>
<OnPlatform x:Key="ButtonStyle" x:TypeArguments="Style">
<On Platform="UWP" Value="{StaticResource SomeStyle}"></On>
</OnPlatform>
</Setter.Value>
</Setter>
</Style>
我尝试使用合并的 ResourceDictionary.MergedDictionaries,但我无法包含 xaml
有人知道吗?
【问题讨论】:
标签: xaml xamarin.forms themes xamarin.forms-styles