I want to pass a specific Enum Value as a ConverterParameter in my Android View.
I am using MvvmCross' MvxBind like this:
local:MvxBind="Visibility Person.Status,
Converter=EqualityToVisibility, ConverterParameter=PersonState.State1"
However the value that gets passed into the Converter's Convert method is the string "PersonState.State1" whereas I want the enum value. How do I tell MVVMCross to pass in the enum. XAML markup has the x:static extension but i cannot see an equivalent for Android layouts
Thanks
This can't be done using the standard value converter and binding syntax. As @Cheesebaron points out in comments, this is similar to the CommandParameter case - see MVVCross: Pass an enum value as a CommandParameter for Android
To achieve the effect you need, I think the easiest route would be to modify your value converter to take and parse a string.
An alternative approach could be to implement a second value converter - ParsePersonStateValueConverter
- which would just take a string input and would return the parsed enum
value. You could then nest this with your equality value converter in your binding expression:
local:MvxBind="Visibility EqualityToVisibility(Person.Status, ParsePersonState('State1'))"