Binding output of Custom Activity designer to activity argument
- by gbanfill
I am trying to add a custom activity designer for an activity that I have. The activity looks a little like:
public class WaitForUserInputActvitiy : NativeActivity
{
public InArgument<UserInteractionProperty[]> UserInteraction { get; set; }
}
I am trying to put a designer on the activity to make it a bit nicer to set these values (so you don't end up typing VB in directly. My designer is based on mindscape property grid. I have an ObservableDictionary source that I want to get the values from and put them in to the InArgument. Currently I am using
private void TestGrid_LostFocus(object sender, RoutedEventArgs e)
{
using (ModelEditingScope editingScope = this.ModelItem.BeginEdit())
{
Argument myArg = Argument.Create(typeof(WaitForUserInputActvitiy), ArgumentDirection.In);
this.ModelItem.Properties["UserInteraction"].SetValue(source.Values.ToArray());
editingScope.Complete();
}
}
However this results in an ArgumentException "Object of type UserInteractionProperty[] cannot be converted to InArgument`1[UserInteractionProperty[]].
So how do I convert my array of UserInteractionProperties into an InArgument?