Пример #1
0
        static void UpdateIncrement(this MauiSlider nativeSlider, ISlider slider)
        {
            double stepping = Math.Min((slider.Maximum - slider.Minimum) / 1000, 1);

            nativeSlider.StepFrequency = stepping;
            nativeSlider.SmallChange   = stepping;
        }
Пример #2
0
 public static void UpdateValue(this MauiSlider nativeSlider, ISlider slider)
 {
     if (nativeSlider.Value != slider.Value)
     {
         nativeSlider.Value = slider.Value;
     }
 }
Пример #3
0
 public static void UpdateMaximumTrackColor(this MauiSlider nativeSlider, ISlider slider, Brush?defaultBackgroundColor)
 {
     if (slider.MaximumTrackColor.IsDefault())
     {
         nativeSlider.Background = defaultBackgroundColor;
     }
     else
     {
         nativeSlider.Background = slider.MaximumTrackColor.ToNative();
     }
 }
Пример #4
0
        static void SwapThumbs(MauiSlider slider)
        {
            if (slider.Thumb == null || slider.ImageThumb == null)
            {
                return;
            }

            if (slider.ThumbImageSource != null)
            {
                slider.Thumb.Visibility      = UI.Xaml.Visibility.Collapsed;
                slider.ImageThumb.Visibility = UI.Xaml.Visibility.Visible;
            }
            else
            {
                slider.Thumb.Visibility      = UI.Xaml.Visibility.Visible;
                slider.ImageThumb.Visibility = UI.Xaml.Visibility.Collapsed;
            }
        }
Пример #5
0
        public static async Task UpdateThumbImageSourceAsync(this MauiSlider nativeSlider, ISlider slider, IImageSourceServiceProvider?provider)
        {
            var thumbImageSource = slider.ThumbImageSource;

            if (thumbImageSource == null)
            {
                nativeSlider.ThumbImageSource = null;
                return;
            }

            if (provider != null && thumbImageSource != null)
            {
                var service = provider.GetRequiredImageSourceService(thumbImageSource);
                var nativeThumbImageSource = await service.GetImageSourceAsync(thumbImageSource);

                nativeSlider.ThumbImageSource = nativeThumbImageSource?.Value;
            }
        }
Пример #6
0
 public static void UpdateMaximum(this MauiSlider nativeSlider, ISlider slider)
 {
     nativeSlider.Maximum = slider.Maximum;
     nativeSlider.UpdateIncrement(slider);
 }