binding-enum-command-parameters
Installation
SKILL.md
WPF Command Parameter Enum Type Binding
Problem Scenario
When binding enum values to CommandParameter in WPF, passing as string causes type mismatch error.
Error Message
System.ArgumentException: 'Parameter "parameter" (object) cannot be of type System.String,
as the command type requires an argument of type MyNamespace.MyEnum.'
Cause
When specifying CommandParameter="Pan" as a string in XAML, WPF passes it as System.String type. However, if the Command expects a specific enum type, automatic type conversion does not occur.