Alex141 / CalcBinding

Advanced WPF Binding which supports expressions in Path property and other features

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can only use equals operator with enum?

jamesdebono opened this issue · comments

I only seem to be able to use the '==' operator for comparing an enum.
Is it possible to use other operators such as '>='?

I tried this:
Visibility="{c:Binding 'CurrentUser.Level>=local:UserLevel.Administrator'}"
And got this error:
Binding error: calc converter can't convert expression{0}>=Enum1.Administrator: The binary operator GreaterThanOrEqual is not defined for the types 'MyNameSpace.UserLevel' and 'MyNameSpace.UserLevel'.

Using the equals operator is working though.

You would have to cast enums to int. This doesn't seem to be supported by CalcBindings