AttachFormatBarToRichtextBox() private method

Attaches a FormatBar to a RichtextBox
private AttachFormatBarToRichtextBox ( global richTextBox, IRichTextBoxFormatBar formatBar ) : void
richTextBox global The RichtextBox to attach to.
formatBar IRichTextBoxFormatBar The Formatbar to attach.
return void
コード例 #1
0
    private static void OnFormatBarPropertyChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
    {
      global::System.Windows.Controls.RichTextBox rtb = d as global::System.Windows.Controls.RichTextBox;
      if( rtb == null )
        throw new Exception( "A FormatBar can only be applied to a RichTextBox." );

      RichTextBoxFormatBarManager manager = new RichTextBoxFormatBarManager();
      manager.AttachFormatBarToRichtextBox( rtb, e.NewValue as IRichTextBoxFormatBar );
    }
コード例 #2
0
        private static void OnFormatBarPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            global::System.Windows.Controls.RichTextBox rtb = d as global::System.Windows.Controls.RichTextBox;
            if (rtb == null)
            {
                throw new Exception("A FormatBar can only be applied to a RichTextBox.");
            }

            RichTextBoxFormatBarManager manager = new RichTextBoxFormatBarManager();

            manager.AttachFormatBarToRichtextBox(rtb, e.NewValue as IRichTextBoxFormatBar);
        }