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

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

Closed
niels9001 opened this issue Mar 3, 2019 · 7 comments
Closed

Comments

@niels9001
Copy link

niels9001 commented Mar 3, 2019

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
Copy link
Collaborator

LocalJoost commented Mar 4, 2019 via email

@pedrolamas
Copy link
Collaborator

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
Copy link
Collaborator

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

@LocalJoost
Copy link
Collaborator

LocalJoost commented Mar 4, 2019 via email

@niels9001
Copy link
Author

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 [email protected] 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 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" /> </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
Copy link
Collaborator

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
Copy link
Member

@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!

0x7c13 added a commit to 0x7c13/Notepads that referenced this issue Oct 21, 2019
Fixed a bug introduced by XAML behaviors: microsoft/XamlBehaviors#154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants