Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix damping sample misbehaving when using wrong locale #1375

Merged
merged 4 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion WinUIGallery/ControlPages/XamlCompInteropPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Input;
using System.Globalization;

namespace AppUIBasics.ControlPages
{
Expand Down Expand Up @@ -42,7 +43,9 @@ float GetDampingRatio()
{
if(DampingStackPanel.SelectedItem != null)
{
return (float)Convert.ToDouble((DampingStackPanel.SelectedItem as RadioButton).Content);
// We need to specify the InvariantCulture since the decimal point depends on the
// system language and might parse "0.8" to 8 since the decimal point is a different character
return (float)Convert.ToDouble((DampingStackPanel.SelectedItem as RadioButton).Content, CultureInfo.InvariantCulture);
}
return 0.6f;
}
Expand Down