private void SetUnderlines(IUnderlineUIDecorationProvider underline) { string underlineToString = "None"; if (underline != null) { DecorationUIConverter decorationConverter = new DecorationUIConverter(); underlineToString = (string)decorationConverter.ConvertTo(underline, typeof(string)); } this.currentUnderline = underline; if (underlineToString == "None") { foreach (CheckBox checkBox in underlinesGrid.Children) { checkBox.IsChecked = false; } } else { foreach (CheckBox checkBox in underlinesGrid.Children) { if (String.Equals(checkBox.Name, underlineToString, StringComparison.InvariantCultureIgnoreCase)) { checkBox.IsChecked = true; break; } } } }
private void ResetInitialValues() { this.initialForeColor = null; this.initialHighlightColor = null; this.initialBaselineAlignment = null; this.initialDialogFontStyle = DialogFontStyle.Empty; this.initialFontSize = null; this.initialFontFamily = null; this.initialUnderline = null; this.currentUnderline = null; this.currentForeColor = null; this.currentHighlightColor = null; }
private void Underlines_Checked(object sender, RoutedEventArgs e) { CheckBox justChecked = sender as CheckBox; DecorationUIConverter decorationConverter = new DecorationUIConverter(); this.currentUnderline = (IUnderlineUIDecorationProvider)decorationConverter.ConvertFrom(null, CultureInfo.CurrentCulture, justChecked.Name); foreach (CheckBox checkBox in this.underlinesGrid.Children) { if (checkBox != justChecked) { checkBox.IsChecked = false; } } }
private void SetFontPropertiesDialog(FontFamily fontFamily, double?fontSize, Color?foreColor, Color?highlightColor, IUnderlineUIDecorationProvider underline, BaselineAlignment?baselineAlignment, FontWeight?fontWeight, FontStyle?fontStyle, bool?strikeThrough) { this.isInInit = true; this.SetFontFamily(fontFamily); this.SetFontSize(fontSize); this.SetForeColor(foreColor); this.SetHighlightColor(highlightColor); this.SetUnderlines(underline); this.SetBaselineAlignment(baselineAlignment); this.SetFontWeightAndStyle(fontWeight, fontStyle); this.SetStrikeThrough(strikeThrough); this.isInInit = false; }
private void SetInitialValues(FontFamily family, double?fontSize, Color?foreColor, Color?highlightColor, Tuples.Windows.FontWeight?fontWeight, Tuples.Windows.FontStyle?fontStyle, IUnderlineUIDecorationProvider underline, bool?strikeThrough, BaselineAlignment?alignment) { this.initialFontFamily = family; if (fontSize.HasValue) { this.initialFontSize = Math.Round(Unit.DipToPoint(fontSize.Value), 2); } this.initialForeColor = foreColor; this.initialHighlightColor = highlightColor; if (fontWeight.HasValue && fontWeight.HasValue) { if (fontWeight.Value == FontWeights.Bold) { if (fontStyle.Value == FontStyles.Italic) { this.initialDialogFontStyle = DialogFontStyle.BoldItalic; } else { this.initialDialogFontStyle = DialogFontStyle.Bold; } } else { if (fontStyle.Value == FontStyles.Italic) { this.initialDialogFontStyle = DialogFontStyle.Italic; } else { this.initialDialogFontStyle = DialogFontStyle.Regular; } } } else { this.initialDialogFontStyle = DialogFontStyle.Empty; } this.initialUnderline = underline; this.initialStrikeThrough = strikeThrough; this.initialBaselineAlignment = alignment; }
private void ShowDialogInternal(StyleDefinition defaultStyle, Action <StyleDefinition> applyCallback, RadRichTextBox owner) { this.defaultStyle = defaultStyle; this.applyCallback = applyCallback; this.SetOwner(owner); StyleUIHelper helper = new StyleUIHelper(owner); FontFamily fontFamily = helper.GetFontFamilyOfSpanStyle(); double? fontSize = helper.GetFontSizeOfSpanStyle(); Color? foreColor = helper.GetForeColorOfSpanStyle(); Color? highlightColor = helper.GetHighlightColorOfSpanStyle(); IUnderlineUIDecorationProvider underlineDecoration = helper.GetUnderlineDecoration(); BaselineAlignment?baselineAlignment = helper.GetBaselineAlignment(); FontWeight? fontWeight = helper.GetFontWeightOfSpanStyle(); FontStyle? fontStyle = helper.GetFontStyleOfSpanStyle(); bool?strikeThrough = helper.GetStrikeThroughOfSpanStyle(); this.SetInitialValues(fontFamily, fontSize, foreColor, highlightColor, fontWeight, fontStyle, underlineDecoration, strikeThrough, baselineAlignment); this.SetFontPropertiesDialog(fontFamily, fontSize, foreColor, highlightColor, underlineDecoration, baselineAlignment, fontWeight, fontStyle, strikeThrough); this.ShowDialog(); }
private void Underlines_Unchecked(object sender, RoutedEventArgs e) { this.currentUnderline = UnderlineTypes.None; }