控件依赖属性:
#region SelectionText
internal static readonly DependencyPropertyKey SelectionTextPropertyKey = DependencyProperty.RegisterReadOnly(
"SelectionText", typeof(string),
typeof(QuJiaoRichTextBox), new PropertyMetadata(string.Empty)
);
public static readonly DependencyProperty SelectionTextProperty = SelectionTextPropertyKey.DependencyProperty;
/// <summary>
/// 当前选择文本(外部只读)
/// </summary>
public string SelectionText
{
get => (string)GetValue(SelectionTextPropertyKey.DependencyProperty);
internal set => SetValue(SelectionTextPropertyKey, value);
}
#endregion
xaml调用时绑定:
SelectionText="{Binding Path=模型的绑定属性名称,ElementName=SelectionText}"