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
If you try to bind an enum to a CommandParameter in UWP, then UWP tends to pass them around the system as the raw type of the enum as opposed to the .net type.
This means that when you bind to it and it fires the CanExecute(object?), that it fails because the type does not match (uint != SortOrder)
But if you create a blank app, and add a ViewModel based on ObservableObject, something like this:
publicpartialclassMainPageViewModel:ObservableObject{[RelayCommand]privatevoidOnSetSortOrder(SortOrderorder){Debug.WriteLine($"Sort order set to {order}");}}publicenumSortOrder:uint{Ascending,Descending}
Describe the bug
If you try to bind an enum to a CommandParameter in UWP, then UWP tends to pass them around the system as the raw type of the enum as opposed to the .net type.
This means that when you bind to it and it fires the CanExecute(object?), that it fails because the type does not match (uint != SortOrder)
Regression
No response
Steps to reproduce
I've provided a bare-bones reproduction here:
https://github.com/[AtomicBlom/EnumRelayCommandTest](https://github.com/AtomicBlom/EnumRelayCommandTest)
But if you create a blank app, and add a ViewModel based on ObservableObject, something like this:
Then attempt to bind to it.
You'll find that it fails
Expected behavior
You should be able to pass an enum as a CommandParameter
Screenshots
No response
IDE and version
VS 2022
IDE version
17.12.4
Nuget packages
Nuget package version(s)
8.4.0
Additional context
This error was also observed while attempting to port a UWP application to .net9
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered: