2015-12-08 90 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