我正在尝试为我拥有的活动添加自定义活动设计器。活动看起来有点像:
public class WaitForUserInputActvitiy : NativeActivity
{
public InArgument<UserInteractionProperty[]> UserInteraction { get; set; }
}
我正在尝试将设计师放在活动上,以便更好地设置这些值(因此您最终不会直接输入 VB。我的设计师基于 mindscape 属性网格。我有一个我想要的 ObservableDictionary 源从中获取值并将它们放入 InArgument。目前我正在使用
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?