public override void OnApplyTemplate() { base.OnApplyTemplate(); Body = GetTemplateChild(BodyName) as Grid; _horizontalSlider = GetTemplateChild(HorizontalSliderName) as SuperSliderUpdate; _verticalSlider = GetTemplateChild(VerticalSliderName) as SuperSliderUpdate; _horizontalSelectedColor = GetTemplateChild(HorizontalSelectedColorName) as Rectangle; _verticalSelectedColor = GetTemplateChild(VerticalSelectedColorName) as Rectangle; if (_horizontalSlider != null) _horizontalSlider.ApplyTemplate(); if (_verticalSlider != null) _verticalSlider.ApplyTemplate(); if (Color.A == 0 && Color.R == 0 && Color.G == 0 && Color.B == 0) Color = System.Windows.Media.Color.FromArgb(255, 6, 255, 0); // this should be theme accent brush I think. else UpdateLayoutBasedOnColor(); if (Thumb == null) Thumb = new ColorSliderThumb(); IsEnabledVisualStateUpdate(); }
private void LayoutWiring(bool isVisible, SuperSliderUpdate slider, FrameworkElement colorElement, string templateName) { if (slider == null) { return; } slider.ValueChanged -= Slider_ValueChanged; var template = GetTemplateChild(templateName) as FrameworkElement; if (template != null) { template.Visibility = (isVisible) ? Visibility.Visible : Visibility.Collapsed; } if (isVisible) { slider.ValueChanged += Slider_ValueChanged; } if (colorElement != null) { colorElement.Visibility = (IsColorVisible) ? Visibility.Visible : Visibility.Collapsed; } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); Body = GetTemplateChild(BodyName) as Grid; _horizontalSlider = GetTemplateChild(HorizontalSliderName) as SuperSliderUpdate; _verticalSlider = GetTemplateChild(VerticalSliderName) as SuperSliderUpdate; _horizontalSelectedColor = GetTemplateChild(HorizontalSelectedColorName) as Rectangle; _verticalSelectedColor = GetTemplateChild(VerticalSelectedColorName) as Rectangle; if (_horizontalSlider != null) { _horizontalSlider.ApplyTemplate(); } if (_verticalSlider != null) { _verticalSlider.ApplyTemplate(); } if (Color.A == 0 && Color.R == 0 && Color.G == 0 && Color.B == 0) { Color = System.Windows.Media.Color.FromArgb(255, 6, 255, 0); // this should be theme accent brush I think. } else { UpdateLayoutBasedOnColor(); } if (Thumb == null) { Thumb = new ColorSliderThumb(); } IsEnabledVisualStateUpdate(); }
private void LayoutWiring(bool isVisible, SuperSliderUpdate slider, FrameworkElement colorElement, string templateName) { if (slider == null) return; slider.ValueChanged -= Slider_ValueChanged; var template = GetTemplateChild(templateName) as FrameworkElement; if (template != null) template.Visibility = (isVisible) ? Visibility.Visible : Visibility.Collapsed; if (isVisible) slider.ValueChanged += Slider_ValueChanged; if(colorElement != null) colorElement.Visibility = (IsColorVisible) ? Visibility.Visible : Visibility.Collapsed; }