Ejemplo n.º 1
0
        private static void AnyTabBrushPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args)
        {
            DDBrushPicker sender = (DDBrushPicker)d;

            sender.BindBrushes();
            sender.UpdatePickedBrush();
        }
Ejemplo n.º 2
0
        private static void PickedBrushPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs args)
        {
            DDBrushPicker sender   = (DDBrushPicker)d;
            Brush         newValue = (Brush)args.NewValue;

            if (sender.ExternalLock)
            {
                return;
            }

            sender.ExternalLock = true;

            if (newValue == null)
            {
                sender.SelectedTab = 0;
            }
            else if (newValue is SolidColorBrush)
            {
                if (newValue != sender.SolidColorBrush)
                {
                    sender.SolidColorBrush = (newValue as SolidColorBrush).Clone();
                }
                sender.SelectedTab = 1;
            }
            else if (newValue is LinearGradientBrush)
            {
                if (newValue != sender.LinearGradientBrush)
                {
                    sender.LinearGradientBrush = (newValue as LinearGradientBrush).Clone();
                }
                sender.SelectedTab = 2;
            }
            else if (newValue is RadialGradientBrush)
            {
                if (newValue != sender.RadialGradientBrush)
                {
                    sender.RadialGradientBrush = (newValue as RadialGradientBrush).Clone();
                }
                sender.SelectedTab = 3;
            }

            sender.ExternalLock = false;

            sender.UpdatePickedBrush();
        }