Example #1
0
        private static void EditingCommandsEx_SelectFontFamily_Executed(Object sender, ExecutedRoutedEventArgs e)
        {
            var editor = sender as RichTextBox;

            if (e.Handled = (editor != null && e.Parameter is FontFamily))
            {
                RichTextBoxToolBarHelper.ApplyNewValueToFormattingProperty <FontFamily>(
                    editor.Selection, Paragraph.FontFamilyProperty, (FontFamily)e.Parameter,
                    (item1, item2) => FontFamily.Equals(item1, item2));
            }
        }
Example #2
0
        private static void EditingCommandsEx_SelectBackgroundColor_Executed(Object sender, ExecutedRoutedEventArgs e)
        {
            var   editor = sender as RichTextBox;
            Color?color  = RichTextBoxToolBarHelper.GetSelectionColor(e.Parameter, Colors.White);

            if (e.Handled = (editor != null && color != null))
            {
                RichTextBoxToolBarHelper.ApplyNewValueToFormattingProperty <SolidColorBrush>(
                    editor.Selection, TextElement.BackgroundProperty, new SolidColorBrush((Color)color),
                    (item1, item2) => SolidColorBrush.Equals(item1, item2));
            }
        }
Example #3
0
        private static void EditingCommandsEx_SelectFontSize_Executed(Object sender, ExecutedRoutedEventArgs e)
        {
            var    editor = sender as RichTextBox;
            Double?size   = RichTextBoxToolBarHelper.GetSelectionFontSize(e.Parameter);

            if (e.Handled = (editor != null && size != null))
            {
                RichTextBoxToolBarHelper.ApplyNewValueToFormattingProperty <Double>(
                    editor.Selection, Paragraph.FontSizeProperty, (Double)size,
                    (item1, item2) => Double.Equals(item1, item2));
            }
        }