0

When using Caliburn.Micro short hand syntax for events, how do we pass a Enum (via ValueConvertor) ?

<MenuItem Header="Open" cal:Message.Attach="[Event Click]=[Action ShowDesigner(<what goes here ?>,'False')]"/>

Where ShowDesigner method sytax is

ShowDesigner(eReportType,bool)

I have already written StringToEnumValueconvertor.

Update

EnumConvertor is as follows

 public class StringToEnumConvertor : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return Enum.Parse(typeof(eReportingTool), (string)value);
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

While the enum looks as

 public enum eReportingTool
{
    StimulsoftReports = 1,
    FastReport
}
sharp
  • 1,191
  • 14
  • 39
Anu Viswan
  • 17,797
  • 2
  • 22
  • 51

1 Answers1

1

You don't need converter to convert from string to enum, just pass your enum item as string.

cal:Message.Attach="[Event Click]=[Action ShowDesigner('StimulsoftReports','false')"
sharp
  • 1,191
  • 14
  • 39