1

我只是了解在 Visual Studio 2012 的 Windows Store App 中创建后退按钮,微软使用这个值/键对

<x:String x:Key="BackButtonGlyph">&#xE071;</x:String>

&#xE071;是 Unicode 吗?如果是,如何获取 Windows 应用商店应用程序的有效代码列表,因为我使用了其中一些代码,它显示了一个空矩形?

4

2 回答 2

2

基于这篇文章我创建了一个样式。

首先,在 StandardStyle.xaml(文件顶部)中添加字符串字典项

<ResourceDictionary.ThemeDictionaries>
         <ResourceDictionary x:Key="Default">
         <x:String x:Key="DeleteButtonGlyph">&#xE107;</x:String>
   </ResourceDictionary>
   .

然后,在另一个或相同的 xaml 文件(样式文件)中添加以下样式

 <Style x:Key="DeleteButtonStyle" TargetType="Button">
    <Setter Property="MinWidth" Value="0"/>
    <Setter Property="ToolTipService.ToolTip" Value="Delete Selected Word"></Setter>
    <Setter Property="Margin" Value="5"/>
    <Setter Property="VerticalAlignment" Value="Bottom"/>
    <Setter Property="FontFamily" Value="Segoe UI Symbol"/>
    <Setter Property="FontWeight" Value="Normal"/>
    <Setter Property="FontSize" Value="24"/>
    <Setter Property="AutomationProperties.AutomationId" Value="DeleteButton"/>
    <Setter Property="AutomationProperties.Name" Value="Delete"/>
    <Setter Property="AutomationProperties.ItemType" Value="Delete Button"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Grid x:Name="RootGrid" Width="80">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <TextBlock Text="&#xE0DD;" FontSize="32" Margin="15, 0,0,0"></TextBlock>
                        <TextBlock x:Name="BackgroundGlyph" FontSize="32" Margin="15,0,0,0" Text="&#xE0DE;" Foreground="{StaticResource BackButtonBackgroundThemeBrush}"/>
                        <TextBlock Grid.Column="0" Grid.Row="0" Margin="25, 9,0,0"  x:Name="NormalGlyph" Text="{StaticResource DeleteButtonGlyph}" Foreground="{StaticResource BackButtonForegroundThemeBrush}"/>
                        <TextBlock Grid.Column="0" Grid.Row="0" Margin="25, 9,0,0" x:Name="ArrowGlyph" Text="{StaticResource DeleteButtonGlyph}" Foreground="{StaticResource BackButtonPressedForegroundThemeBrush}" Opacity="0"/>
                        <TextBlock Margin="0,10,0,5" Grid.Row="1" FontSize="12" Text="Delete Word" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
                    </Grid>

                    <VisualStateManager.VisualStateGroups>
                        <VisualStateGroup x:Name="CommonStates">
                            <VisualState x:Name="Normal" />
                            <VisualState x:Name="PointerOver">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverForegroundThemeBrush}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Pressed">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonForegroundThemeBrush}"/>
                                    </ObjectAnimationUsingKeyFrames>
                                    <DoubleAnimation
                                        Storyboard.TargetName="ArrowGlyph"
                                        Storyboard.TargetProperty="Opacity"
                                        To="1"
                                        Duration="0"/>
                                    <DoubleAnimation
                                        Storyboard.TargetName="NormalGlyph"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0"
                                        Duration="0"/>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Disabled">
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="RootGrid" Storyboard.TargetProperty="Visibility">
                                        <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </VisualState>
                        </VisualStateGroup>
                        <VisualStateGroup x:Name="FocusStates">
                            <VisualState x:Name="Focused">
                                <Storyboard>
                                    <DoubleAnimation
                                        Storyboard.TargetName="FocusVisualWhite"
                                        Storyboard.TargetProperty="Opacity"
                                        To="1"
                                        Duration="0"/>
                                    <DoubleAnimation
                                        Storyboard.TargetName="FocusVisualBlack"
                                        Storyboard.TargetProperty="Opacity"
                                        To="1"
                                        Duration="0"/>
                                </Storyboard>
                            </VisualState>
                            <VisualState x:Name="Unfocused" />
                            <VisualState x:Name="PointerFocused" />
                        </VisualStateGroup>
                    </VisualStateManager.VisualStateGroups>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
于 2012-11-29T10:28:33.483 回答
1

关于获取有效代码列表,如果您有 Windows 8 设备可以运行它,我强烈推荐此应用程序。它提供了大量现有 Windows 8 Dev 图标及其匹配代码的列表。它还让您更好地了解它们在 Metro 环境中的显示方式,并且该应用程序还提供了 XAML 示例,用于在各种结构中呈现图标,包括按钮、文本框或 AppBar。

正如您在上面的链接中看到的那样,您已经将 Metro Icons 作为字体,但我建议使用我提供的应用程序作为参考,以便轻松找到每个图标的代码。

于 2013-08-14T12:28:47.597 回答