I want to pass an enum value as command parameter in WPF, using something like this:
<Button
x:Name="uxSearchButton"
Command="{Binding Path=SearchMembersCommand}"
CommandParameter="SearchPageType.First"
Content="Search">
</Button>
SearchPageType
is an enum and this is to know from which button search command is invoked.
Is this possible in WPF, or how can you pass an enum value as command parameter?
Try this
local
- is your namespace reference in the XAMLAlso remember that if your enum is inside another class you need to use the
+
operator.You can use property element syntax instead of attribute syntax for this:
Also if you want to provide a [
Flags
] enum you can use the property element syntax: