Setting multiple enum flags in XAML

K Mehta picture K Mehta · Oct 10, 2011 · Viewed 7.1k times · Source

Is there any way to set multiple enum flags (that are traditionally separated by | in codebehind) in XAML? I tried something like:

<ns:SomeControl Flags="FlagA|FlagB" />

but that didn't work.

Answer

FunnyItWorkedLastTime picture FunnyItWorkedLastTime · Oct 11, 2011

WPF does support this through a type converter. It can be done by using a comma in between enum values:

<ns:SomeControl Flags="FlagA,FlagB" />