1.ActivityXamlServices类的主要功能是从XAML文件创建活动树的实例。提供了下面四个方法:
CreateBuilderReader:Overloaded. Maps an x:Class activity tree to an ActivityBuilder or ActivityBuilder<(Of <(TResult>)>).
CreateBuilderWriter:Maps an ActivityBuilder or ActivityBuilder<(Of <(TResult>)>) from the specified writer to an
x:Class activity tree.
CreateReader:Overloaded. Maps an x:Class activity tree to an DynamicActivity or DynamicActivity<(Of <(TResult>)>).
Load:Overloaded. Creates an instance of a declarative workflow.
Load方法遇到标记有<Activity x:Class的XAML会返回一个DynamicActivity.
2.下面一个具体的例子:
<?xml version="1.0" encoding="utf-16"?> <Activity x:Class="HelloWorldCary" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <x:Members> <x:Property Name="input1" Type="InArgument(x:String)" /> <x:Property Name="input2" Type="InArgument(x:String)" /> <x:Property Name="output" Type="OutArgument(x:String)" /> </x:Members> <Sequence> <WriteLine Text="Getting Started" /> <Delay Duration="00:00:04" /> <WriteLine Text="[input1+input2]" /> <Assign x:TypeArguments="x:String" To="[output]" Value="[input1+input2+" that's ok!"]" /> </Sequence> </Activity>
作者:生鱼片
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。