microsoft / XamlBehaviors

This is the official home for UWP XAML Behaviors on GitHub.
MIT License
700 stars 112 forks source link

DataTriggerBehaviour: exception when using 0.6 for French locale? #154

Closed niels9001 closed 5 years ago

niels9001 commented 5 years ago

Hi all,

I'm using the following code to change the opacity of the selected item of a GridView.

<Core:DataTriggerBehavior Binding="{Binding ElementName=RoomsView, Path=SelectedItem.Id, Mode=OneWay}" Value="{Binding Id}" ComparisonCondition="NotEqual">
                                <Core:ChangePropertyAction TargetObject="{Binding ElementName=TitleTxt}" PropertyName="Opacity" Value="0,6" /> <!-- Needs to be a , else it will crash on French -->
                            </Core:DataTriggerBehavior>

Now this code runs fine. However, when I switch the language to French the app crashes. It can somehow not parse 0.6. When I enter 0,6 (mind the comma) it runs fine.

This is the exeption:

System.ArgumentException: 'Impossible d'attribuer une valeur de type String à la propriété Windows.UI.Xaml.PropertyPath de type Double. Seules des valeurs de type Double peuvent être attribuées à la propriété Windows.UI.Xaml.PropertyPath.'

Inner exception: FormatException: Input string was not in a correct format.`

Is there some parsing going wrong here wrt the point and the comma?

Regards, Niels

LocalJoost commented 5 years ago

Hmm. That probably means somewhere a string is parsed without using invariant culture. Very peculiar no-one ever hit that before.

Joost van Schaik

Windows Development MVP Sent from mail for Windows 10

"The world as I envision it in my head is such a more interesting place"


From: Niels Laute notifications@github.com Sent: Sunday, March 3, 2019 10:21:52 PM To: Microsoft/XamlBehaviors Cc: Subscribed Subject: [Microsoft/XamlBehaviors] DataTriggerBehaviour: exception when using 0.6 for French locale? (#154)

Hi all,

I'm using the following code to change the opacity of the selected item of a GridView.

Now this code runs fine. However, when I switch the language to French the app crashes. It can somehow not parse 0.6. When I enter 0,6 (mind the comma) it runs fine. This is the exeption: `System.ArgumentException: 'Impossible d'attribuer une valeur de type String à la propriété Windows.UI.Xaml.PropertyPath de type Double. Seules des valeurs de type Double peuvent être attribuées à la propriété Windows.UI.Xaml.PropertyPath.' Inner exception: FormatException: Input string was not in a correct format.` Is there some parsing going wrong here wrt the point and the comma? Regards, Niels — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
pedrolamas commented 5 years ago

Issue confirmed, as one can see here!

For some weird reason, this is using CultureInfo.CurrentCulture instead of CultureInfo.InvariantCulture... notice that this is only if the data type is double, for int we actually use the correct invariant culture.

pedrolamas commented 5 years ago

I've now pushed a fix, waiting for someone else to review & comment on it.

LocalJoost commented 5 years ago

Did review. No comment 😉

Joost van Schaik

Windows Development MVP Sent from mail for Windows 10

"The world as I envision it in my head is such a more interesting place"


From: Pedro Lamas notifications@github.com Sent: Monday, March 4, 2019 11:39:18 AM To: Microsoft/XamlBehaviors Cc: Joost van Schaik; Comment Subject: Re: [Microsoft/XamlBehaviors] DataTriggerBehaviour: exception when using 0.6 for French locale? (#154)

I've now pushed a fix, waiting for someone else to review & comment on it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/XamlBehaviors/issues/154#issuecomment-469204815, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AD8Bn_8DjUp4u7nHcVzzpikXwjyyUcbjks5vTPfWgaJpZM4bbP7N.

niels9001 commented 5 years ago

Hmm. That probably means somewhere a string is parsed without using invariant culture. Very peculiar no-one ever hit that before. Joost van Schaik Windows Development MVP Sent from mail for Windows 10 "The world as I envision it in my head is such a more interesting place" ____ From: Niels Laute notifications@github.com Sent: Sunday, March 3, 2019 10:21:52 PM To: Microsoft/XamlBehaviors Cc: Subscribed Subject: [Microsoft/XamlBehaviors] DataTriggerBehaviour: exception when using 0.6 for French locale? (#154) Hi all, I'm using the following code to change the opacity of the selected item of a GridView. </Core:DataTriggerBehavior> Now this code runs fine. However, when I switch the language to French the app crashes. It can somehow not parse 0.6. When I enter 0,6 (mind the comma) it runs fine. This is the exeption: System.ArgumentException: 'Impossible d'attribuer une valeur de type String à la propriété Windows.UI.Xaml.PropertyPath de type Double. Seules des valeurs de type Double peuvent être attribuées à la propriété Windows.UI.Xaml.PropertyPath.' Inner exception: FormatException: Input string was not in a correct format. Is there some parsing going wrong here wrt the point and the comma? Regards, Niels — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub<#154>, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AD8Bn4O0TslXaFce6paX2kpExFZ4S4NIks5vTDzwgaJpZM4bbP7N.

Yep, I found out when French users trying to start the new update.. oops :).

@PedroLamas @LocalJoost Thanks for the quick help, guys! Hopefully it gets merged and pushed to NuGet soon!

pedrolamas commented 5 years ago

This is now merged, but pushing a new NuGet package is out of my hands... @karann-msft or @mgoertz-msft any chance you can help with that?

mgoertz-msft commented 5 years ago

@PedroLamas Of course. Looking at the source history for the repo it looks like this is really the only functional change since the last release and it affects the managed SDK only. There have been some changes in the NuGet publishing process that we will need to adopt first but it will make it a lot easier and faster going forward.

@branh Could you please bump the version numbers to 2.0.1 and set up the publishing pipeline similar to the WPF Behaviors? Thank you!