我正在尝试为我有的活动添加自定义活动设计器。活动看起来有点像:将自定义活动设计器的输出绑定到活动参数
public class WaitForUserInputActvitiy : NativeActivity
{
public InArgument<UserInteractionProperty[]> UserInteraction { get; set; }
}
我试图把设计师的活动,使之更好一点来设置这些值(这样你就不会结束在直接键入VB我的设计师。基于思维空间属性网格,我有我想从这些值,并把它们到InArgument的ObservableDictionary来源。目前我使用
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();
}
}
然而这会导致一个ArgumentException“的类型UserInteractionProperty [对象]无法转换为InArgument`1 [UserInteractionProperty []]。
那么如何将UserInteractionProperties数组转换为InArgument?