2015-12-08 45 views
0

Microsoft使用特定的符号作为信息目的它是一个带有字母i的圆圈Image of the Symbol。我查看了有关Segoe MDL2 Assets Font的所有资源,但没有找到该符号。有谁知道这个符号是字体的一部分还是只是另一个图像?MDL2信息符号

回答

1

符号代码点是E946


下WPF代码片段创建一个包含所有Segoe MDL2 Assets符号代码百分点IEnumerable<int>

var typeface = new Typeface(
    new FontFamily("Segoe MDL2 Assets"), 
    FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); 

GlyphTypeface glyphTypeface; 
typeface.TryGetGlyphTypeface(out glyphTypeface); 

var codePoints = glyphTypeface.CharacterToGlyphMap.Keys.Where(c => c > 0x20); 

您可以轻松地通过设置DataContext = codePoints,写作ItemsControls这样想象这个集合:

<ItemsControl ItemsSource="{Binding}"> 
    <ItemsControl.ItemTemplate> 
     <DataTemplate> 
      <StackPanel Orientation="Horizontal"> 
       <TextBlock 
        Margin="2" VerticalAlignment="Center" 
        Text="{Binding StringFormat={}{0:X4}}"/> 
       <TextBlock 
        Margin="2" FontFamily="Segoe MDL2 Assets" FontSize="24" 
        Text="{Binding Converter={StaticResource CodePointConverter}}"/> 
      </StackPanel> 
     </DataTemplate> 
    </ItemsControl.ItemTemplate> 
</ItemsControl> 

这个CodePointConverter类:

public class CodePointConverter : IValueConverter 
{ 
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
    { 
     return new string((char)(int)value, 1); 
    } 

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 
    { 
     throw new NotSupportedException(); 
    } 
} 
+0

THX,我会尝试,当我来了家。你有任何资源,真正的任何符号列出? – Rasetech

+0

有[Symbol](https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.symbol)enum和[this page](https:// msdn .microsoft.com/EN-US /库/窗/应用/ jj841126.aspx)。 – Clemens