示例#1
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));
            }
        }
        private Boolean SetFontSize(Object fontSize)
        {
            RichTextBox editor  = this.CurrentEditor;
            Double?     newSize = RichTextBoxToolBarHelper.GetSelectionFontSize(fontSize);

            if (editor != null && newSize != null)
            {
                EditingCommandsEx.SelectFontSize.Execute(
                    (Double)newSize, editor);

                editor.Focus();
                this.IsOverflowOpen = false;

                return(true);
            }

            return(false);
        }