diff --git a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml index 3c32e73e8a..9d717562c4 100644 --- a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml +++ b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml @@ -7694,12 +7694,6 @@ Gets or sets the content to be rendered inside the component. - - - - - - Gets or sets the slider's minimal value. diff --git a/src/Core/Components/Slider/FluentSlider.razor b/src/Core/Components/Slider/FluentSlider.razor index 283e710424..aadd44d995 100644 --- a/src/Core/Components/Slider/FluentSlider.razor +++ b/src/Core/Components/Slider/FluentSlider.razor @@ -13,7 +13,7 @@ orientation="@Orientation.ToAttributeValue()" mode="@Mode.ToAttributeValue()" id="@Id" - value=@CurrentValueAsString + value="@BindConverter.FormatValue(Value?.ToString())" disabled="@Disabled" name=@Name required=@Required diff --git a/src/Core/Components/Slider/FluentSlider.razor.cs b/src/Core/Components/Slider/FluentSlider.razor.cs index 67e477a7e1..45316c012d 100644 --- a/src/Core/Components/Slider/FluentSlider.razor.cs +++ b/src/Core/Components/Slider/FluentSlider.razor.cs @@ -8,18 +8,9 @@ namespace Microsoft.FluentUI.AspNetCore.Components; -public partial class FluentSlider : FluentInputBase, IAsyncDisposable +public partial class FluentSlider : FluentInputBase where TValue : System.Numerics.INumber { - private const string JAVASCRIPT_FILE = "./_content/Microsoft.FluentUI.AspNetCore.Components/Components/Slider/FluentSlider.razor.js"; - - /// - [Inject] - private IJSRuntime JSRuntime { get; set; } = default!; - - /// - private IJSObjectReference? _jsModule { get; set; } - /// /// Gets or sets the slider's minimal value. /// @@ -73,18 +64,6 @@ protected override void OnParametersSet() ArgumentNullException.ThrowIfNull(Step, nameof(Step)); } - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - _jsModule ??= await JSRuntime.InvokeAsync("import", JAVASCRIPT_FILE); - } - if (_jsModule is not null) - { - await _jsModule!.InvokeVoidAsync("updateSlider", Element); - } - } - protected override bool TryParseValueFromString(string? value, [MaybeNullWhen(false)] out TValue result, [NotNullWhen(false)] out string? validationErrorMessage) { if (BindConverter.TryConvertTo(value, CultureInfo.InvariantCulture, out result)) @@ -142,21 +121,4 @@ private static string GetStepAttributeValue() throw new InvalidOperationException($"The type '{targetType}' is not a supported numeric type."); } } - - public async ValueTask DisposeAsync() - { - try - { - if (_jsModule is not null) - { - await _jsModule.DisposeAsync(); - } - } - catch (Exception ex) when (ex is JSDisconnectedException || - ex is OperationCanceledException) - { - // The JSRuntime side may routinely be gone already if the reason we're disposing is that - // the client disconnected. This is not an error. - } - } }