Skip to content

Commit 67ac167

Browse files
Make Virtualize work in cultures that use alternate number formatting (#26432)
1 parent e62bd65 commit 67ac167

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Components/Web/src/Virtualization/Virtualize.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Diagnostics;
7+
using System.Globalization;
78
using System.Linq;
89
using System.Threading;
910
using System.Threading.Tasks;
@@ -246,7 +247,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
246247
}
247248

248249
private string GetSpacerStyle(int itemsInSpacer)
249-
=> $"height: {itemsInSpacer * _itemSize}px;";
250+
=> $"height: {(itemsInSpacer * _itemSize).ToString(CultureInfo.InvariantCulture)}px;";
250251

251252
void IVirtualizeJsCallbacks.OnBeforeSpacerVisible(float spacerSize, float spacerSeparation, float containerSize)
252253
{
@@ -367,7 +368,7 @@ private ValueTask<ItemsProviderResult<TItem>> DefaultItemsProvider(ItemsProvider
367368
private RenderFragment DefaultPlaceholder(PlaceholderContext context) => (builder) =>
368369
{
369370
builder.OpenElement(0, "div");
370-
builder.AddAttribute(1, "style", $"height: {_itemSize}px;");
371+
builder.AddAttribute(1, "style", $"height: {_itemSize.ToString(CultureInfo.InvariantCulture)}px;");
371372
builder.CloseElement();
372373
};
373374

0 commit comments

Comments
 (0)