Xaml MDL2信息符号
微软使用一个特定的符号作为信息用途,它是一个圆圈,里面有字母i。我查看了有关Segoe MDL2资产字体的所有资源,但没有找到该符号。有人知道这个符号是字体的一部分还是另一个图像吗?符号代码点是Xaml MDL2信息符号,xaml,fonts,assets,Xaml,Fonts,Assets,微软使用一个特定的符号作为信息用途,它是一个圆圈,里面有字母i。我查看了有关Segoe MDL2资产字体的所有资源,但没有找到该符号。有人知道这个符号是字体的一部分还是另一个图像吗?符号代码点是E946 以下WPF代码段创建了一个IEnumerable,其中包含Segoe MDL2资产中的所有符号代码点 var typeface = new Typeface( new FontFamily("Segoe MDL2 Assets"), FontStyles.Normal, Fon
E946
以下WPF代码段创建了一个
IEnumerable
,其中包含Segoe MDL2资产中的所有符号代码点
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
并编写一个Items控件,可以轻松地可视化此集合,如下所示:
<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>
谢谢,我回家后会试试的。你有没有列出任何符号的资源?有枚举和。
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();
}
}