Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use enum as a ConverterParameter?

Currently i'm using integer as the ConverterParameter, and casting it to the Enum in the Converter. I find it very unreadable in the XAML.

I wonder if there is a way to declare the Enum in the resources section and pass its value as ConverterParameter?

like image 274
MichaelS Avatar asked Dec 20 '11 19:12

MichaelS


1 Answers

The easiest way is to use x:Static.

{Binding ..., ConverterParameter={x:Static YourEnum.YourEnumValue}}
like image 133
Julien Lebosquain Avatar answered Sep 27 '22 23:09

Julien Lebosquain