Esempio n. 1
0
        private static void OnColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            BrushPicker brush = d as BrushPicker;

            if ((brush.Brush as SolidColorBrush).Color != brush.Color)
            {
                //DiagramVM diagram = (brush.Tag as DiagramBuilderVM).SelectedDiagram as DiagramVM;
                //GroupTransactions group = new GroupTransactions();
                //group.ContinuousUndoRedo = ContinuousUndoRedo.Start;
                //diagram.HistoryManager.BeginComposite(diagram.HistoryManager, group);
                brush.Brush = new SolidColorBrush(brush.Color);

                var converter = new System.Windows.Media.BrushConverter();

                Brush brushS = (Brush)converter.ConvertFromString(e.NewValue.ToString());
                if ((brush.DataContext as DiagramButtonViewModel).Label == "Label")
                {
                    ((brush.Tag as DiagramBuilderVM).SelectedDiagram.SelectedItems as SelectorVM).LabelForeground = (brushS as SolidColorBrush);
                }
                else if ((brush.DataContext as DiagramButtonViewModel).Label == "Fill")
                {
                    ((brush.Tag as DiagramBuilderVM).SelectedDiagram.SelectedItems as SelectorVM).Fill = (brushS as SolidColorBrush);
                }
                else if ((brush.DataContext as DiagramButtonViewModel).Label == "Stroke")
                {
                    ((brush.Tag as DiagramBuilderVM).SelectedDiagram.SelectedItems as SelectorVM).Stroke = (brushS as SolidColorBrush);
                }

                brush.PickerTemp.IsDropDownOpen = false;
                //GroupTransactions group1 = new GroupTransactions();
                //group1.ContinuousUndoRedo = ContinuousUndoRedo.End;
                //diagram.HistoryManager.EndComposite(diagram.HistoryManager, group1);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This method is used to change the color.
        /// </summary>
        /// <param name="d">
        /// The d.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private static void OnColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            BrushPicker brush = d as BrushPicker;

            if ((brush.Brush as SolidColorBrush).Color != brush.Color)
            {
                brush.Brush = new SolidColorBrush(brush.Color);

                SelectorVM selector = (brush.Tag as DiagramBuilderVM).SelectedDiagram.SelectedItems as SelectorVM;

                BrushConverter converter = new BrushConverter();

                Brush brushS = (Brush)converter.ConvertFromString(e.NewValue.ToString());
                if ((brush.DataContext as DiagramButtonViewModel).Label == "Label")
                {
                    selector.LabelForeground = brushS as SolidColorBrush;
                }
                else if ((brush.DataContext as DiagramButtonViewModel).Label == "Fill")
                {
                    selector.Fill = brushS as SolidColorBrush;
                }
                else if ((brush.DataContext as DiagramButtonViewModel).Label == "Stroke")
                {
                    selector.Stroke = brushS as SolidColorBrush;
                }

                brush.PickerTemp.IsDropDownOpen = false;
            }
        }
Esempio n. 3
0
        private static void OnBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            BrushPicker brush = d as BrushPicker;

            if ((brush.Brush as SolidColorBrush).Color != brush.Color)
            {
                brush.Color = (brush.Brush as SolidColorBrush).Color;
            }
        }