コード例 #1
0
		protected override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

			Body = GetTemplateChild(BodyName) as Grid;

			_horizontalSlider = GetTemplateChild(HorizontalSliderName) as SuperSlider;
			_verticalSlider = GetTemplateChild(VerticalSliderName) as SuperSlider;

			_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 = Windows.UI.Color.FromArgb(255, 6, 255, 0); // this should be theme accent brush I think.
			else
				UpdateLayoutBasedOnColor();

			if (Thumb == null)
				Thumb = new ColorSliderThumb();

			IsEnabledVisualStateUpdate();
		}
コード例 #2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            Body = GetTemplateChild(BodyName) as Grid;

			_slider = GetTemplateChild(SliderName) as SuperSlider; 
			//_slider = GetTemplateChild(SliderName) as SuperSliderUpdate;

            _selectedColor = GetTemplateChild(SelectedColorName) as Rectangle;

            if (_slider != null)
            {
	            _slider.ApplyTemplate();
				_slider.ValueChanged += Slider_ValueChanged;

                if (Color.A == 0 && Color.R == 0 && Color.G == 0 && Color.B == 0)
                    Color = System.Windows.Media.Color.FromArgb(255, 6, 255, 0);
                else
                    UpdateLayoutBasedOnColor();
            }

			if (Thumb == null)
				Thumb = new ColorSliderThumb();

			SizeChanged += UserControl_SizeChanged;

			IsEnabledVisualStateUpdate();
        }
コード例 #3
0
 void Start()
 {
     Slider = GetComponentInChildren <SuperSlider>();
     if (PlayerHealth != null)
     {
         PlayerHealth.OnChange += HandleHealthChange;
     }
 }
コード例 #4
0
		private void LayoutWiring(bool isVisible, SuperSlider 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;
		}