private void SetValSliderBackground(HSVSlider colorSlider, Color leftColor, Color rightColor) { double hueLeft, saturationLeft, valueLeft; double hueRight, saturationRight, valueRight; ColorUtils.ConvertRgbToHsv(leftColor, out hueLeft, out saturationLeft, out valueLeft); if (saturationLeft != 0 && valueLeft != 0) { colorSlider.LeftColor = ColorUtils.ConvertHsvToRgb(hueLeft, saturationLeft, 0.0); } ColorUtils.ConvertRgbToHsv(rightColor, out hueRight, out saturationRight, out valueRight); if (saturationRight != 0 && valueRight != 0) { colorSlider.RightColor = ColorUtils.ConvertHsvToRgb(hueRight, saturationRight, 1.0); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); 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_satSlider = GetTemplateChild(SatSliderName) as HSVSlider; m_valSlider = GetTemplateChild(ValSliderName) as HSVSlider; m_colorHex = GetTemplateChild(ColorHexName) as ColorHex; m_hsvControl = GetTemplateChild(HsvControlName) as HsvControl; m_hueWheel = GetTemplateChild(HueWheelName) as HueWheel; m_hueSlider = GetTemplateChild(HueSliderName) as SpectrumSlider; m_templateApplied = true; UpdateControlColors(SelectedColor); }