Dialog cannot be moved horizontally with CultureInfo "de-DE" #767

Closed
opened 2026-01-29 17:43:05 +00:00 by claunia · 0 comments
Owner

Originally created by @einfach-edel on GitHub (Mar 10, 2023).

Description:
A draggable dialog cannot be moved horizontally while using a german CultureInfo.

Bug:
String interpolation uses the current CultureInfo. This is not always English. This means that a culture-specific decimal separator is used and the style can no longer be interpreted.

a0f3d44832/Radzen.Blazor/Rendering/DialogContainer.razor (L86-L90)

Conjecture:
The string formate should be done using the invariant culture.

void OnDrag(DraggableEventArgs args)
{
    left = string.Format(CultureInfo.InvariantCulture, "left: {0}px;", args.Rect.Left + (args.ClientX - clientX));
    top = string.Format(CultureInfo.InvariantCulture, "top: {0}px;", args.Rect.Top + (args.ClientY - clientY));
}

PoC:
Installing middleware to force a culture with different decimal separator

app.Use(async (ctx, next) =>
{
    CultureInfo.CurrentCulture = new CultureInfo("de-DE");
    await next();
});

This has the consequence that the dialog can no longer be moved horizontally because invalid "style" values are present.
image

Originally created by @einfach-edel on GitHub (Mar 10, 2023). Description: A draggable dialog cannot be moved horizontally while using a german CultureInfo. Bug: String interpolation uses the current CultureInfo. This is not always English. This means that a culture-specific decimal separator is used and the style can no longer be interpreted. https://github.com/radzenhq/radzen-blazor/blob/a0f3d44832afbd15f999d386586eedf0ccb13732/Radzen.Blazor/Rendering/DialogContainer.razor#L86-L90 Conjecture: The string formate should be done using the invariant culture. ```csharp void OnDrag(DraggableEventArgs args) { left = string.Format(CultureInfo.InvariantCulture, "left: {0}px;", args.Rect.Left + (args.ClientX - clientX)); top = string.Format(CultureInfo.InvariantCulture, "top: {0}px;", args.Rect.Top + (args.ClientY - clientY)); } ``` PoC: Installing middleware to force a culture with different decimal separator ```csharp app.Use(async (ctx, next) => { CultureInfo.CurrentCulture = new CultureInfo("de-DE"); await next(); }); ``` This has the consequence that the dialog can no longer be moved horizontally because invalid "style" values are present. ![image](https://user-images.githubusercontent.com/61247514/224344434-2c9e6bf2-9f1f-49c8-a3f1-2acf7451dd08.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#767