Exemplo n.º 1
1
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Body = GetTemplateChild(BodyName) as Grid;
            Slider = GetTemplateChild(SliderName) as SuperSlider;

            if (Thumb == null)
                Thumb = new ColorSliderThumb();

            SelectedColor = GetTemplateChild(SelectedColorName) as Rectangle;
            
            SizeChanged += UserControl_SizeChanged;

            if (Slider != null)
            {
                Slider.ValueChanged += Slider_ValueChanged;

                if (Color.A == 0 && Color.R == 0 && Color.G == 0 && Color.B == 0)
                    Color = System.Windows.Media.Color.FromArgb(255, 6, 255, 0);
                else
                    UpdateLayoutBasedOnColor();
            }

			IsEnabledVisualStateUpdate();
        }
Exemplo n.º 2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Body   = GetTemplateChild(BodyName) as Grid;
            Slider = GetTemplateChild(SliderName) as SuperSlider;

            if (Thumb == null)
            {
                Thumb = new ColorSliderThumb();
            }

            SelectedColor = GetTemplateChild(SelectedColorName) as Rectangle;

            SizeChanged += UserControl_SizeChanged;

            if (Slider != null)
            {
                Slider.ValueChanged += Slider_ValueChanged;

                if (Color.A == 0 && Color.R == 0 && Color.G == 0 && Color.B == 0)
                {
                    Color = System.Windows.Media.Color.FromArgb(255, 6, 255, 0);
                }
                else
                {
                    UpdateLayoutBasedOnColor();
                }
            }

            IsEnabledVisualStateUpdate();
        }
Exemplo n.º 3
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            SampleSelector   = GetTemplateChild(SampleSelectorName) as Grid;
            SelectedHueColor = GetTemplateChild(SelectedHueColorName) as Rectangle;

            var body = GetTemplateChild(BodyName) as Grid;

            if (body != null)
            {
                _monitor           = new MovementMonitor();
                _monitor.Movement += _monitor_Movement;
                _monitor.MonitorControl(body);
            }

            ColorSlider = GetTemplateChild(ColorSliderName) as ColorSlider;

            if (ColorSlider != null)
            {
                if (Thumb == null)
                {
                    Thumb = new ColorSliderThumb();
                }

                ColorSlider.ColorChanged += ColorSlider_ColorChanged;

                if (SelectedHueColor != null)
                {
                    var binding = new System.Windows.Data.Binding
                    {
                        Source = ColorSlider,
                        Path   = new PropertyPath("SolidColorBrush"),
                    };

                    SelectedHueColor.SetBinding(Shape.FillProperty, binding);
                }
            }
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            SampleSelector = GetTemplateChild(SampleSelectorName) as Grid;
            SelectedHueColor = GetTemplateChild(SelectedHueColorName) as Rectangle;

            var body = GetTemplateChild(BodyName) as Grid;

            if (body != null)
            {
                _monitor = new MovementMonitor();
                _monitor.Movement += _monitor_Movement;
                _monitor.MonitorControl(body);
            }

            ColorSlider = GetTemplateChild(ColorSliderName) as ColorSlider;

            if (ColorSlider != null)
            {
                if (Thumb == null)
                    Thumb = new ColorSliderThumb();

                ColorSlider.ColorChanged += ColorSlider_ColorChanged;

                if(SelectedHueColor != null)
                {
                    var binding = new System.Windows.Data.Binding
                                      {
                                          Source = ColorSlider,
                                          Path = new PropertyPath("SolidColorBrush"),
                                      };

                    SelectedHueColor.SetBinding(Shape.FillProperty, binding);
                }
            }
        }