public static void ApplyLanguageFont(TextBlock textBlock, LanguageFont languageFont) { FontFamily fontFamily = new FontFamily(languageFont.FontFamily); textBlock.FontFamily = fontFamily; textBlock.FontWeight = languageFont.FontWeight; textBlock.FontStyle = languageFont.FontStyle; textBlock.FontStretch = languageFont.FontStretch; }
public MainPage() { this.InitializeComponent(); // Set brushes textBlockBrush = Resources["ApplicationForegroundThemeBrush"] as SolidColorBrush; textBoxBrush = Resources["TextBoxForegroundThemeBrush"] as SolidColorBrush; errorBrush = new SolidColorBrush(Colors.Red); // Why aren't these set in the generated C# files? editBox = splitContainer.Child1 as TabbableTextBox; resultContainer = splitContainer.Child2 as RulerContainer; // Set a fixed-pitch font for the TextBox Language language = new Language(Windows.Globalization.Language.CurrentInputMethodLanguageTag); LanguageFontGroup languageFontGroup = new LanguageFontGroup(language.LanguageTag); LanguageFont languageFont = languageFontGroup.FixedWidthTextFont; editBox.FontFamily = new FontFamily(languageFont.FontFamily); Loaded += OnLoaded; Application.Current.Suspending += OnApplicationSuspending; }