コード例 #1
0
        /// <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);
        }
コード例 #2
0
 private void SetColorSliderBackground(ColorSlider colorSlider, Color leftColor, Color rightColor)
 {
     colorSlider.LeftColor  = leftColor;
     colorSlider.RightColor = rightColor;
 }
コード例 #3
0
ファイル: ColorPicker.cs プロジェクト: JuroGandalf/Ragnarok
 private void SetColorSliderBackground(ColorSlider colorSlider, Color leftColor, Color rightColor)
 {
     colorSlider.LeftColor  = leftColor;
     colorSlider.RightColor = rightColor;
 }
コード例 #4
0
ファイル: ColorPicker.cs プロジェクト: JuroGandalf/Ragnarok
        /// <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);

        }