private void ChangeTextProperty(DependencyProperty dp, string value) { if (TextZone == null) { return; } TextSelection ts = TextZone.Selection; if (ts != null) { ts.ApplyPropertyValue(dp, value); } TextZone.Focus(); }
private void UnderlineBnt_Unselected(object sender, RoutedEventArgs e) { if (TextZone == null) { return; } TextSelection ts = TextZone.Selection; if (ts != null) { (ts.GetPropertyValue(Inline.TextDecorationsProperty) as TextDecorationCollection).TryRemove(TextDecorations.Underline, out TextDecorationCollection textDecorations); ts.ApplyPropertyValue(Inline.TextDecorationsProperty, textDecorations); } TextZone.Focus(); }