private void StyleRun(Run Run, Scope Scope) { string foreground = null; string background = null; bool italic = false; bool bold = false; if (Styles.Contains(Scope.Name)) { Styling.Style style = Styles[Scope.Name]; foreground = style.Foreground; background = style.Background; italic = style.Italic; bold = style.Bold; } if (!string.IsNullOrWhiteSpace(foreground)) { Run.Foreground = foreground.GetSolidColorBrush(); } //Background isn't supported, but a workaround could be created. if (italic) { Run.FontStyle = FontStyle.Italic; } if (bold) { Run.FontWeight = FontWeights.Bold; } }
private void StyleRun(Run Run, Scope Scope) { string foreground = null; string background = null; bool italic = false; bool bold = false; if (Styles.Contains(Scope.Name)) { ColorCode.Styling.Style style = Styles[Scope.Name]; foreground = style.Foreground; background = style.Background; italic = style.Italic; bold = style.Bold; } if (!string.IsNullOrWhiteSpace(foreground)) { Run.Foreground = foreground.GetSolidColorBrush(); } if (!string.IsNullOrWhiteSpace(background)) { Run.Background = background.GetSolidColorBrush(); } if (italic) { Run.FontStyle = FontStyles.Italic; } if (bold) { Run.FontWeight = FontWeights.Bold; } }