コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: fednep/UV-Outliner
 public void ApplyUndoAwarePropertyValue(MyEdit edit, TextRange range,
     DependencyProperty property, object value)
 {
     edit.ApplyUndoAwarePropertyValue(range, property, value);
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: fednep/UV-Outliner
        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;
        }