# binding-enum-command-parameters > Binds enum values to WPF CommandParameter using x:Static markup extension. Use when passing enum types to commands or avoiding string-based command parameter errors. - Author: vincent - Repository: christian289/dotnet-with-claudecode - Version: 20260129011625 - Stars: 11 - Forks: 0 - Last Updated: 2026-02-07 - Source: https://github.com/christian289/dotnet-with-claudecode - Web: https://mule.run/skillshub/@@christian289/dotnet-with-claudecode~binding-enum-command-parameters:20260129011625 --- --- name: binding-enum-command-parameters description: "Binds enum values to WPF CommandParameter using x:Static markup extension. Use when passing enum types to commands or avoiding string-based command parameter errors." --- # 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. --- ## Solution ### Use `x:Static` to Directly Reference Enum Value ```xml xmlns:viewmodels="clr-namespace:MyApp.ViewModels;assembly=MyApp.ViewModels"