[英]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"></x:String>

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"></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="" FontSize="32" Margin="15, 0,0,0"></TextBlock>
<TextBlock x:Name="BackgroundGlyph" FontSize="32" Margin="15,0,0,0" Text="" 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.