diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Slider.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Slider.cs index 19f592e05baf..ac272a6698d5 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Slider.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Slider.cs @@ -12,6 +12,7 @@ using MUXControlsTestApp.Utilities; using Uno.Extensions; using Uno.UI.RuntimeTests.Helpers; + #if WINAPPSDK using Uno.UI.Extensions; #elif __IOS__ @@ -74,6 +75,35 @@ public async Task When_Slider_Constrained_Vertical() Assert.AreEqual(0, slider.VerticalDecreaseRect.ActualHeight); } +#if HAS_UNO + [TestMethod] + public async Task When_Value_Decimal() + { + if (!FeatureConfiguration.ToolTip.UseToolTips) + { + Assert.Inconclusive("ToolTips are not enabled on this target"); + return; + } + + var slider = new Slider() + { + Value = 0.5, + Minimum = 0, + Maximum = 1, + StepFrequency = 0.01, + Orientation = Orientation.Horizontal, + }; + WindowHelper.WindowContent = slider; + await WindowHelper.WaitForLoaded(slider); + + var thumb = VisualTreeUtils.FindVisualChildByName(slider, "HorizontalThumb"); + var toolTip = ToolTipService.GetToolTipReference(thumb); + var tb = (TextBlock)toolTip.Content; + var text = tb.Text; + Assert.AreEqual("0.50", text); + } +#endif + #if HAS_UNO [TestMethod] #if !HAS_INPUT_INJECTOR diff --git a/src/Uno.UI/UI/Xaml/Controls/Slider/Slider.mux.cs b/src/Uno.UI/UI/Xaml/Controls/Slider/Slider.mux.cs index 3a94cbef2492..0a8346f46005 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Slider/Slider.mux.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Slider/Slider.mux.cs @@ -1512,16 +1512,16 @@ public object Convert(object value, Type targetType, object parameter, string la szFormat = "{0:0}"; break; case 1: - szFormat = "{0:0.0}f"; + szFormat = "{0:0.0}"; break; case 2: - szFormat = "{0:0.00}f"; + szFormat = "{0:0.00}"; break; case 3: - szFormat = "{0:0.000}f"; + szFormat = "{0:0.000}"; break; default: - szFormat = "{0:0.0000}f"; + szFormat = "{0:0.0000}"; break; } }