/// <summary> /// テンプレート適用時に呼ばれます。 /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); if (m_redColorSlider != null) { m_redColorSlider.ValueChanged -= OnColorSliderValueChanged; } if (m_greenColorSlider != null) { m_greenColorSlider.ValueChanged -= OnColorSliderValueChanged; } if (m_blueColorSlider != null) { m_blueColorSlider.ValueChanged -= OnColorSliderValueChanged; } if (m_alphaColorSlider != null) { m_alphaColorSlider.ValueChanged -= OnColorSliderValueChanged; } if (m_spectrumSlider != null) { m_spectrumSlider.HueChanged -= OnHsvSliderValueChanged; } m_redColorSlider = GetTemplateChild(RedColorSliderName) as ColorSlider; m_greenColorSlider = GetTemplateChild(GreenColorSliderName) as ColorSlider; m_blueColorSlider = GetTemplateChild(BlueColorSliderName) as ColorSlider; m_alphaColorSlider = GetTemplateChild(AlphaColorSliderName) as ColorSlider; m_spectrumSlider = GetTemplateChild(SpectrumSliderName) as SpectrumSlider; m_hsvControl = GetTemplateChild(HsvControlName) as HsvControl; if (m_redColorSlider != null) { m_redColorSlider.ValueChanged += OnColorSliderValueChanged; } if (m_greenColorSlider != null) { m_greenColorSlider.ValueChanged += OnColorSliderValueChanged; } if (m_blueColorSlider != null) { m_blueColorSlider.ValueChanged += OnColorSliderValueChanged; } if (m_alphaColorSlider != null) { m_alphaColorSlider.ValueChanged += OnColorSliderValueChanged; } if (m_spectrumSlider != null) { m_spectrumSlider.HueChanged += OnHsvSliderValueChanged; } m_templateApplied = true; UpdateControlColors(SelectedColor); }
private void SetColorSliderBackground(ColorSlider colorSlider, Color leftColor, Color rightColor) { colorSlider.LeftColor = leftColor; colorSlider.RightColor = rightColor; }