public void ApplyUndoAwarePropertyValue(MyEdit edit, TextRange range, DependencyProperty property, object value) { edit.ApplyUndoAwarePropertyValue(range, property, value); }
private SolidColorBrush SelectColor(MyEdit edit, TextRange range) { SolidColorBrush currentBrush = Brushes.Black; SolidColorBrush newBrush = null; if (range.GetPropertyValue(ForegroundProperty) != DependencyProperty.UnsetValue) { currentBrush = (SolidColorBrush)range.GetPropertyValue(ForegroundProperty); } ColorPickerDialog colorPicker = new ColorPickerDialog(); colorPicker.Owner = this; colorPicker.cPicker.SelectedColor = currentBrush.Color; if (colorPicker.ShowDialog() == true) { newBrush = new SolidColorBrush(colorPicker.cPicker.SelectedColor); if (edit != null) { edit.ApplyUndoAwarePropertyValue(range, ForegroundProperty, newBrush); } else { ApplyUndoEnabledPropertyValue(OutlinerTree.SelectedItem, ForegroundProperty, newBrush); } } UpdateFontSettings(range); return newBrush; }