In Expression Blend 4 (Silverlight project) I have a UserControl to which I have added a CLR property. This property is an enum type, which is defined within the UC. I have attached a ChangePropertyAction behaviour to an instance of the UC. However, the XAML parser gives the following error (among others):
'+' is not valid in a name
This is because the following XAML (snippet) has been generated:
<local:SomeControl Margin="155,113,317,0" d:LayoutOverrides="Width, Height">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonDown">
<ei:ChangePropertyAction PropertyName="MyProp">
<ei:ChangePropertyAction.Value>
<local:SomeControl+MyEnum>Second</local:SomeControl+MyEnum> <----- Error on this line caused by the '+'
</ei:ChangePropertyAction.Value>
</ei:ChangePropertyAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</local:SomeControl>
The code behind:
public partial class SomeControl : UserControl
{
public SomeControl()
{
// Required to initialize variables
InitializeComponent();
}
public MyEnum MyProp
{
get; set;
}
public enum MyEnum
{
First,
Second,
Third
}
}
A simple workround is to "promote" the enum out from within the class (eg SomeControl_MyEnum), but is there a cleaner solution?