microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.34k stars 677 forks source link

Cannot assign text value '4' into property '...' of type UInt32 #5639

Open sylveon opened 3 years ago

sylveon commented 3 years ago

Describe the bug It's impossible to declare a uint (in C#) or uint32_t (in C++) dependency property and then use it from XAML.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Declare a dependency property of type uint in a control or other XAML-enabled thing.
  2. Try to assign a value to this property from XAML.

Expected behavior I expected this to work

Screenshots image

Version Info

NuGet package version: No NuGet package used

Windows app type: UWP Win32
Yes Yes (system XAML islands)
Windows version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

asklar commented 3 years ago

CC @RealTommyKlein @evelynwu-msft

michael-hawker commented 3 years ago

This happens with C# UWP as well (pretty sure it's always been like this?):

image

Would be nice to get some automatic type-safety/value-coercion by being able to limit the type.