Make Virtualize work in cultures that use alternate number formatting (#26432)

This commit is contained in:
Steve Sanderson 2020-09-29 21:17:23 +01:00 committed by GitHub
parent e62bd65421
commit 67ac1675c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@ -246,7 +247,7 @@ namespace Microsoft.AspNetCore.Components.Web.Virtualization
}
private string GetSpacerStyle(int itemsInSpacer)
=> $"height: {itemsInSpacer * _itemSize}px;";
=> $"height: {(itemsInSpacer * _itemSize).ToString(CultureInfo.InvariantCulture)}px;";
void IVirtualizeJsCallbacks.OnBeforeSpacerVisible(float spacerSize, float spacerSeparation, float containerSize)
{
@ -367,7 +368,7 @@ namespace Microsoft.AspNetCore.Components.Web.Virtualization
private RenderFragment DefaultPlaceholder(PlaceholderContext context) => (builder) =>
{
builder.OpenElement(0, "div");
builder.AddAttribute(1, "style", $"height: {_itemSize}px;");
builder.AddAttribute(1, "style", $"height: {_itemSize.ToString(CultureInfo.InvariantCulture)}px;");
builder.CloseElement();
};