You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to implement FluentSelect as a culture picker in my Blazor Hybrid Maui application. Previously, I utilized an HTML select, which functioned correctly in all scenarios
@page "/"
@using System.Globalization
<h1>@Resources.Resource1.HelloWorld</h1>
<strong>Culture:</strong>
<select @bind="Culture">
@foreach (var culture in cultures)
{
<option value="@culture">@culture.DisplayName</option>
}
</select>
@code
{
CultureInfo[] cultures = new[]
{
new CultureInfo("en-GB"),
new CultureInfo("pl-PL")
};
CultureInfo Culture
{
get => CultureInfo.CurrentCulture;
set
{
if (CultureInfo.CurrentCulture != value)
{
Thread.CurrentThread.CurrentCulture = value;
Thread.CurrentThread.CurrentUICulture = value;
CultureInfo.DefaultThreadCurrentCulture = value;
CultureInfo.DefaultThreadCurrentUICulture = value;
}
}
}
}
However, when I replace the HTML select with FluentUI select, I encounter issues when one of the available cultures is set to "en-GB". It appears as though the FluentUI select is caught in an infinite loop within the setter of the Culture property, when I switch the culture to "en-US", the FluentUI select operates as expected.
@page "/"
@using System.Globalization
<h1>@Resources.Resource1.HelloWorld</h1>
<FluentSelect
Items="@cultures"
@bind-SelectedOption="Culture">
</FluentSelect>
@code
{
CultureInfo[] cultures = new[]
{
new CultureInfo("en-GB"), // Only breaks on en-GB - en-US works fine
new CultureInfo("pl-PL")
};
CultureInfo Culture
{
get => CultureInfo.CurrentCulture;
set
{
if (CultureInfo.CurrentCulture != value)
{
Thread.CurrentThread.CurrentCulture = value;
Thread.CurrentThread.CurrentUICulture = value;
CultureInfo.DefaultThreadCurrentCulture = value;
CultureInfo.DefaultThreadCurrentUICulture = value;
}
}
}
}
It's strange, but it doesn't seem to come from a particular culture, but from the lack of "Default Culture" in the list of proposals. Is this possible?
In any case, adding CultureInfo.CurrentCulture works for me.
馃悰 Bug Report
I am attempting to implement FluentSelect as a culture picker in my Blazor Hybrid Maui application. Previously, I utilized an HTML select, which functioned correctly in all scenarios
However, when I replace the HTML select with FluentUI select, I encounter issues when one of the available cultures is set to "en-GB". It appears as though the FluentUI select is caught in an infinite loop within the setter of the Culture property, when I switch the culture to "en-US", the FluentUI select operates as expected.
馃捇 Repro or Code Sample
https://github.com/bpsc-wkubis/maui-fluentui-broken-select-with-cultureinfo
馃 Expected Behavior
Select works fine with all Cultures
馃槸 Current Behavior
Select breaks on
馃拋 Possible Solution
馃敠 Context
Implement Culture selector based on FluentSelect.
馃實 Your Environment
The text was updated successfully, but these errors were encountered: