static void UpdateIncrement(this MauiSlider nativeSlider, ISlider slider) { double stepping = Math.Min((slider.Maximum - slider.Minimum) / 1000, 1); nativeSlider.StepFrequency = stepping; nativeSlider.SmallChange = stepping; }
public static void UpdateValue(this MauiSlider nativeSlider, ISlider slider) { if (nativeSlider.Value != slider.Value) { nativeSlider.Value = slider.Value; } }
public static void UpdateMaximumTrackColor(this MauiSlider nativeSlider, ISlider slider, Brush?defaultBackgroundColor) { if (slider.MaximumTrackColor.IsDefault()) { nativeSlider.Background = defaultBackgroundColor; } else { nativeSlider.Background = slider.MaximumTrackColor.ToNative(); } }
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; } }
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; } }
public static void UpdateMaximum(this MauiSlider nativeSlider, ISlider slider) { nativeSlider.Maximum = slider.Maximum; nativeSlider.UpdateIncrement(slider); }