如何从另一个“松散 Xaml”定义的活动调用“松散 Xaml”定义的活动?
我有两个“松散”的 XAML 文件,每个文件都以声明方式定义由一些自定义(编译的)代码活动组成的复合活动。
现在,我希望第一个“松散”Xaml 中定义的活动“包含”第二个“松散”Xaml 中定义的活动的步骤。
但是,我不知道如何将两个活动“粘合”在一起,以便第一个活动知道从第二个 Xaml 正确加载活动。
因此,在调用时:
XamlXmlReader xr = new XamlXmlReader(@"FirstLooseActivity.xaml");
ActivityBuilder ab = (ActivityBuilder)XamlServices.Load(ActivityXamlServices.CreateBuilderReader(xr));
我最终遇到 XamlObjectWriterException (在将所有相关程序集加载到托管应用程序后):
Cannot create unknown type '{clr-namespace:SecondLooseActivity}MyActivity
由于 MS 中没有 Xlink 支持,有没有办法做到这一点?
如果没有,我有什么选择?
I have two "loose" XAML files, each declarativly defining composite activity which is composed of some custom (compiled) code-activities.
Now, I would like the activity defined in the 1st "loose" Xaml to 'contain' the activity defined in the 2nd "loose" Xaml as of its steps.
However, I have no clue how to 'glue' both activities together such that 1st activity will know to correctly load the activity from the 2nd Xaml.
So when calling:
XamlXmlReader xr = new XamlXmlReader(@"FirstLooseActivity.xaml");
ActivityBuilder ab = (ActivityBuilder)XamlServices.Load(ActivityXamlServices.CreateBuilderReader(xr));
I end up with a XamlObjectWriterException (after I loaded all relevant assemblies to my hosting app):
Cannot create unknown type '{clr-namespace:SecondLooseActivity}MyActivity
Since there is no Xlink support in MS, is there a way to do this at all?
If not, what are my alternatives?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了完全相同的问题并找到了解决方案。
我的 XAML 如下所示:
对我有用的技巧是在命名空间中指定包含我的自定义活动的程序集。
将命名空间更改为此使其工作:
I had the exact same issue and found a solution.
Here's what my XAML looked like this:
The trick that worked for me was to specify the assembly containing my custom activity in the namespace.
Changing the namespace to this made it work: