public class AlertTextBox: RichTextBox {
public static readonly DependencyProperty SelectedTextProperty = DependencyProperty.Register(nameof(SelectedText), typeof(string), typeof(AlertTextBox));
public string SelectedText
{
get => (string)GetValue(SelectedTextProperty);
set => SetValue(SelectedTextProperty, value);
}
public AlertTextBox(){
Selection.Changed += SelectionChanged;
}
public void SelectionChanged(object sender, EventArgs e) => SetCurrentValue(SelectedTextProperty, Selection.Text);
}
public class AlertTextBox: RichTextBox {
public static readonly DependencyProperty SelectedTextProperty = DependencyProperty.Register(nameof(SelectedText), typeof(string), typeof(AlertTextBox));
public string SelectedText
{
get => (string)GetValue(SelectedTextProperty);
set => SetValue(SelectedTextProperty, value);
}
public AlertTextBox(){
Selection.Changed += SelectionChanged;
}
public void SelectionChanged(object sender, EventArgs e) => SetCurrentValue(SelectedTextProperty, Selection.Text);
}