public static void ApplyFont(this Windows.UI.Xaml.Documents.TextElement self, Font font) { self.FontSize = font.UseNamedSize ? font.NamedSize.GetFontSize() : font.FontSize; self.FontFamily = font.ToFontFamily(); self.FontStyle = font.FontAttributes.HasFlag(FontAttributes.Italic) ? FontStyle.Italic : FontStyle.Normal; self.FontWeight = font.FontAttributes.HasFlag(FontAttributes.Bold) ? FontWeights.Bold : FontWeights.Normal; }
public static void ApplyFont(this Windows.UI.Xaml.Documents.TextElement self, Font font) { self.FontSize = font.UseNamedSize ? font.NamedSize.GetFontSize() : font.FontSize; self.FontFamily = !string.IsNullOrEmpty(font.FontFamily) ? new FontFamily(font.FontFamily) : (FontFamily)WApplication.Current.Resources["ContentControlThemeFontFamily"]; self.FontStyle = font.FontAttributes.HasFlag(FontAttributes.Italic) ? FontStyle.Italic : FontStyle.Normal; self.FontWeight = font.FontAttributes.HasFlag(FontAttributes.Bold) ? FontWeights.Bold : FontWeights.Normal; }