在 UWP 中获取强调色的变化 [英] Get Variations of Accent color in UWP

查看:18
本文介绍了在 UWP 中获取强调色的变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用主题资源 SystemAccentColorLight1 SystemAccentColorLight2 ...

我收到此异常:找不到与此错误代码相关的文本.

找不到名称/键为 SystemAccentColorLight1 的资源 [行:15 位置:19]

<Grid.ColumnDefinitions><ColumnDefinition Width="60"/><列定义/><列定义/></Grid.ColumnDefinitions><Grid.RowDefinitions><行定义/><行定义/></Grid.RowDefinitions><Image Source="{Binding Path=Owner.ProfileImage}" Width="50" Height="50" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"></图像><TextBlock Text="{Binding Title}" FontSize="12" TextWrapping="WrapWholeWords" FontWeight="SemiBold" Grid.Column="1" Grid.ColumnSpan="2"/><TextBlock Text="{Binding Path=Owner.DisplayName}" VerticalAlignment="Bottom" Horizo​​ntalAlignment="Left" FontSize="9" Grid.Column="1" Grid.Row="1"/></网格>

<块引用>

https://msdn.microsoft.com/windows/uwp/style/color?f=255&MSPPError=-2147217396

在 XAML 中,主要强调色作为名为的主题资源公开系统重点色.色调可作为SystemAccentColorLight3, SystemAccentColorLight2,SystemAccentColorLight1, SystemAccentColorDark1,SystemAccentColorDark2 和 SystemAccentColorDark3.也提供通过 UISettings.GetColorValue 和 UIColorType 以编程方式枚举.

解决方案

正如@Mark W 所说,SystemAccentColorLight1 来自较新的 SDK.

我使用 Window 10 Enterprise Insider Preview 版进行了测试,操作系统版本为 14316.1000.它可以获得更轻的强调色变化.

欢迎您加入 Windows 预览体验计划,您可以下载 预览 SDK 以使用此功能.

备注:

某些信息与预发布产品有关,在商业发布之前可能会对其进行实质性修改.Microsoft 对此处提供的信息不作任何明示或暗示的保证.

I'm trying to get a lighter variation of accent color using theme resource SystemAccentColorLight1 SystemAccentColorLight2 ...

I'm getting this exception: The text associated with this error code could not be found.

Cannot find a Resource with the Name/Key SystemAccentColorLight1 [Line: 15 Position: 19]

<Grid Background="{ThemeResource ResourceKey= SystemAccentColorLight1}"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Padding="5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="60" />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Image Source="{Binding Path=Owner.ProfileImage}" Width="50" Height="50" Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"></Image>
            <TextBlock Text="{Binding Title}" FontSize="12" TextWrapping="WrapWholeWords" FontWeight="SemiBold" Grid.Column="1" Grid.ColumnSpan="2"/>
            <TextBlock Text="{Binding Path=Owner.DisplayName}" VerticalAlignment="Bottom" HorizontalAlignment="Left" FontSize="9" Grid.Column="1" Grid.Row="1" />
        </Grid>

https://msdn.microsoft.com/windows/uwp/style/color?f=255&MSPPError=-2147217396

In XAML, the primary accent color is exposed as a theme resource named SystemAccentColor. The shades are available as SystemAccentColorLight3, SystemAccentColorLight2, SystemAccentColorLight1, SystemAccentColorDark1, SystemAccentColorDark2, and SystemAccentColorDark3. Also available programmatically via UISettings.GetColorValue and the UIColorType enum.

解决方案

As @Mark W said, the SystemAccentColorLight1 is from a newer SDK.

I test it with Window 10 Enterprise Insider Preview Edition and OS Build is 14316.1000. It can get the lighter variation of accent color.

You're welcome to join the Windows Insider Program and you can download preview SDK to use this feature.

Remarks:

Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

这篇关于在 UWP 中获取强调色的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆