简体   繁体   English

在Windows应用商店应用程序(Windows 8 Metro)中创建图标的最佳方法?

[英]Best way for creating Icons in Windows Store Applications (Windows 8 Metro)?

I just understand for creating back button in Windows Store App in visual studio 2012 , Microsoft use this Value/Key pairs 我只是理解在Visual Studio 2012中的Windows应用商店应用中创建后退按钮,Microsoft使用此值/密钥对

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

&#xE071; is a Unicode? 是Unicode吗? If yes how can obtain the list of valid codes for Windows Store Application because I use some of them and It shows me a empty rectangle? 如果是,如何获取Windows应用商店应用程序的有效代码列表,因为我使用了其中的一些,它显示了一个空矩形?

based on This article I create a style. 基于这篇文章我创建了一个样式。

First, add string dictionary item in StandardStyle.xaml (top of the file) 首先,在StandardStyle.xaml中添加字符串字典项(文件顶部)

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

Then, add following style in another or same xaml file ( style file ) 然后,在另一个或相同的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>

In regards to getting a list of valid codes, I would strongly recommend this application if you have a Windows 8 device to run it on. 关于获取有效代码列表,如果你有一个运行它的Windows 8设备,我强烈推荐这个应用程序。 It provides a list of a large number of existing Windows 8 Dev icons and their matching codes. 它提供了大量现有Windows 8 Dev图标及其匹配代码的列表。 It also gives you a better idea of how they would appear in a Metro environment and the app also provides examples of XAML to use to present the icons within various structures, including within buttons, text boxes, or the AppBar. 它还可以让您更好地了解它们在Metro环境中的显示方式,该应用程序还提供了XAML的示例,用于在各种结构中显示图标,包括按钮,文本框或AppBar。

As you can see in your link above you already have the Metro Icons as fonts but I would recommend using the application I give as a reference to easily find the code for each one. 正如您在上面的链接中看到的那样,您已经将Metro图标作为字体,但我建议使用我提供的应用程序作为参考,以便轻松找到每个图标的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 极其简单的应用程序和文本文件,是在Windows Store上分发的最佳方法? - Extremely simple app and a text file, best way to distribute on Windows Store? 这是使用MVVM设计模式创建新窗口的最佳方法 - Which is the best way for creating new windows using the MVVM design pattern 在Windows Store App(8 Metro)中将事件分配给Usercontrol的属性 - assign an event to a Usercontrol's property in Windows Store App ( 8 Metro ) 如何在WPF中使用Windows应用商店库(与WinRT / Metro相同)? - How to using Windows store app (same as winRT/metro) library in WPF? Windows 8 Metro风格列表框 - Windows 8 Metro style listbox 在Windows 8中多目标到城域和非城域目标平台 - Multitargetting to metro and non metro target platform in Windows 8 使 WPF 应用程序看起来像 Metro 风格,即使在 Windows 7 中? (窗口铬/主题/主题) - Making WPF applications look Metro-styled, even in Windows 7? (Window Chrome / Theming / Theme) 在Windows 8 Metro应用程序中将CollectionViewSource分组 - Grouped CollectionViewSource in windows 8 metro application 适用于XAML的Windows Metro中的DrawingBrush - Where Is DrawingBrush In Windows Metro for XAML 在Windows 8 Metro App中对GridView进行分组 - Grouping GridView in Windows 8 Metro App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM