drop事件后的RichTextBox文本

时间:2018-01-22 09:23:56

标签: c# wpf richtextbox dependency-properties

我有一个自定义的RichTextBox,其中Text属性包含纯文本和依赖属性的文本' Rtf'包含文本为rtf。当我通过拖放移动文本时,我想在删除后更新此Rtf属性。例如,当我将文本从RichTextBox移动到TextBox时,我在TextBox中成功删除后查找事件。为此目的是否有任何事件?

简单示例:

public class RichTextBox : System.Windows.Controls.RichTextBox
{
    static RichTextBox()
    {
        DefaultStyleKeyProperty.OverrideMetadata(typeof(RichTextBox), new FrameworkPropertyMetadata(typeof(RichTextBox)));
    }

 public string Rtf
    {
        get { return (string)GetValue(RtfProperty); }
        set
        {
            SetValue(RtfProperty, value);
        }
    }

    // Using a DependencyProperty as the backing store for Text.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty RtfProperty =
        DependencyProperty.Register("Rtf", typeof(string), typeof(RichTextBox), new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnRtfPropertyChanged));
}

0 个答案:

没有答案