How do I pass True
to a CommandParameter
?
Currently I am imperatively adding Boolean.True
to the resource dictionary, but that seems like a clumsy way to do it.
Because command parameters are of type 'object' the XAML parser is unable to perform type conversion for you. If you pass 'true', the parser has no way of knowing that you want this converted to a boolean value. You will have to do this explicitly. You could use the property element syntax:
<Button>
<Button.CommandParameter>
<sys:Boolean>true</sys:Boolean>
</Button.CommandParameter>
</Button>
Where the sys namepsace is mapped:
xmlns:sys="clr-namespace:System;assembly=mscorlib"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With