Beispiel #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (_colorShadingCanvas != null)
            {
                _colorShadingCanvas.MouseLeftButtonDown -= ColorShadingCanvas_MouseLeftButtonDown;
                _colorShadingCanvas.MouseLeftButtonUp   -= ColorShadingCanvas_MouseLeftButtonUp;
                _colorShadingCanvas.MouseMove           -= ColorShadingCanvas_MouseMove;
                _colorShadingCanvas.SizeChanged         -= ColorShadingCanvas_SizeChanged;
            }

            _colorShadingCanvas = GetTemplateChild("PART_ColorShadingCanvas") as Canvas;

            if (_colorShadingCanvas != null)
            {
                _colorShadingCanvas.MouseLeftButtonDown += ColorShadingCanvas_MouseLeftButtonDown;
                _colorShadingCanvas.MouseLeftButtonUp   += ColorShadingCanvas_MouseLeftButtonUp;
                _colorShadingCanvas.MouseMove           += ColorShadingCanvas_MouseMove;
                _colorShadingCanvas.SizeChanged         += ColorShadingCanvas_SizeChanged;
            }

            _colorShadeSelector = GetTemplateChild("PART_ColorShadeSelector") as Canvas;

            if (_colorShadeSelector != null)
            {
                _colorShadeSelector.RenderTransform = _colorShadeSelectorTransform;
            }

            if (_spectrumSlider != null)
            {
                _spectrumSlider.ValueChanged -= SpectrumSlider_ValueChanged;
            }

            _spectrumSlider = GetTemplateChild("PART_SpectrumSlider") as ColorSpectrumSlider;

            if (_spectrumSlider != null)
            {
                _spectrumSlider.ValueChanged += SpectrumSlider_ValueChanged;
            }

            UpdateRGBValues(SelectedColor);
            UpdateColorShadeSelectorPosition(SelectedColor);
        }
Beispiel #2
0
		public override void OnApplyTemplate() {
			base.OnApplyTemplate();

			if (_colorShadingCanvas != null) {
				_colorShadingCanvas.MouseLeftButtonDown -= ColorShadingCanvas_MouseLeftButtonDown;
				_colorShadingCanvas.MouseLeftButtonUp -= ColorShadingCanvas_MouseLeftButtonUp;
				_colorShadingCanvas.MouseMove -= ColorShadingCanvas_MouseMove;
				_colorShadingCanvas.SizeChanged -= ColorShadingCanvas_SizeChanged;
			}

			_colorShadingCanvas = GetTemplateChild("PART_ColorShadingCanvas") as Canvas;

			if (_colorShadingCanvas != null) {
				_colorShadingCanvas.MouseLeftButtonDown += ColorShadingCanvas_MouseLeftButtonDown;
				_colorShadingCanvas.MouseLeftButtonUp += ColorShadingCanvas_MouseLeftButtonUp;
				_colorShadingCanvas.MouseMove += ColorShadingCanvas_MouseMove;
				_colorShadingCanvas.SizeChanged += ColorShadingCanvas_SizeChanged;
			}

			_colorShadeSelector = GetTemplateChild("PART_ColorShadeSelector") as Canvas;

			if (_colorShadeSelector != null)
				_colorShadeSelector.RenderTransform = _colorShadeSelectorTransform;

			if (_spectrumSlider != null)
				_spectrumSlider.ValueChanged -= SpectrumSlider_ValueChanged;

			_spectrumSlider = GetTemplateChild("PART_SpectrumSlider") as ColorSpectrumSlider;

			if (_spectrumSlider != null)
				_spectrumSlider.ValueChanged += SpectrumSlider_ValueChanged;

			UpdateRGBValues(SelectedColor);
			UpdateColorShadeSelectorPosition(SelectedColor);
		}