Windows Workflow Foundation 4.0 ActivityDesigner [英] Windows Workflow Foundation 4.0 ActivityDesigner

查看:75
本文介绍了Windows Workflow Foundation 4.0 ActivityDesigner的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好.自定义活动与我同在,并与activityDesigner关联.通过按下位于activityDesigner上的按钮,显示用户可以在其中设置值的WPF表单.在关闭此表单时,应在ExpressionTextBox中显示值.提示,是否可以连接到(显示)?

< 树液 : ActivityDesigner x : Class ="; ActivityLibrary.SendMailDesigner"

xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns : x =""http://schemas. microsoft.com/winfx/2006/xaml";

xmlns : s =" clr-namespace:System; assembly = mscorlib"

xmlns : net =" clr-namespace:System. Net.Mail; assembly = System"

xmlns : 树液 =" clr-namespace:System. Activities.Presentation; assembly = System.Activities.Presentation"

xmlns : sapc =" clr-namespace:System. Activities.Presentation.Converters; assembly = System.Activities.Presentation"

xmlns : sapv =" clr-namespace:System. Activities.Presentation.View; assembly = System.Activities.Presentation" mc : 无法理解 =" d" xmlns : d ="http://schemas.microsoft.com/expression/blend/2008" xmlns : mc =&" ; http://schemas.openxmlformats.org/markup-compatibility/2006">

xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" >

< 树液 : ActivityDesigner.Resources >

< sapc : ArgumentToExpressionConverter x : Uid =""sadv:ArgumentToExpressionConverter_1"" x : Key ="argumentToExpressionConverter" />

<sapc:ArgumentToExpressionConverter x:Uid="sadv:ArgumentToExpressionConverter_1" x:Key="argumentToExpressionConverter" />

</ sap : ActivityDesigner.Resources >

< Expander >

< Grid 高度 ="108" Horizo​​ntalAlignment =" Left" 名称 ="grid1" VerticalAlignment ="顶" 宽度 =&" ; 278>

<Grid Height="108" HorizontalAlignment="Left" Name="grid1" VerticalAlignment="Top" Width="278">

< Label 内容 =" Body" Horizo​​ntalAlignment =" Left" 名称 =" labelBody" VerticalAlignment =" Top"/>

<Label Content="Body" HorizontalAlignment="Left" Name="labelBody" VerticalAlignment="Top" />

< sapv : ExpressionTextBox Grid.Column ="1" Horizo​​ntalAlignment =" Left" 名称 ="ctrlBody" VerticalAlignment ="Top"

<sapv:ExpressionTextBox Grid.Column="1" HorizontalAlignment="Left" Name="ctrlBody" VerticalAlignment="Top"

AutomationProperties.AutomationId ="To"

Expression =&; { Binding 路径 = ModelItem.Body, 模式 = TwoWay, 转换器 = { StaticResource a rgumentToExpressionConverter }, ConverterParameter = In}

Expression="{Binding Path=ModelItem.Body, Mode=TwoWay, Converter={StaticResource argumentToExpressionConverter}, ConverterParameter=In}"

ExpressionType =&; { x : Type TypeName = s:String}"

OwnerActivity =&; { Binding 路径 = ModelItem, 模式 = OneWay}""

/> -我的ActivityDesigner

公共局部类 SendMailDesigner

{

private void button1_Click(对象发件人 RoutedEventArgs e)

{

MainWindow f = new MainWindow ();

if(f.ShowDialog ()== true)

{

对象o = f.测试;//f.Test-字符串

this.ctrlBody.Expression -如何设置值???

}

推荐答案

假设您的ETB绑定到"Foo" [在上面的代码中,您绑定到Body,我不确定这是您要绑定的对象,除非Body是表达式,否则您可能希望将其绑定到InArgument< String>. ]

无论如何,在旁边的代码中,您需要执行

this.ModelItem.Properties ["Foo"].SetValue(此处的值)

现在,如果将ETB绑定到Foo,则您很可能希望将对话框返回的所有内容包装在VBValue表达式中

,就像
/>
this.ModelItem.Properties ["Foo"].SetValue(新的VisualBasicValue {ExpressionText ="此处构造的VB表达式字符串" }));


基本上,您不想尝试直接在UI元素上设置Expression,而是将其写入到ETB绑定的基础数据对象.

matt

Let's say that your ETB is bound to "Foo" [in your code above, you bind to Body, I'm not sure that's what you want to bind it to, unless Body is the expression, you likely want to bind it to an InArgument<String> ]

Anyway, in the code beside you need to do

this.ModelItem.Properties["Foo"].SetValue(your value here)

Now, if an ETB is bound to Foo, you most likely want to wrap whatever is returned from the dialog in a VBValue expression

which would look like

this.ModelItem.Properties["Foo"].SetValue(new VisualBasicValue { ExpressionText= "your constructed VB expression string here" } );


Basically, you don't want to try to set the Expression directly on the UI Element, write it to the underlying data object that the ETB is bound to.

matt


这篇关于Windows Workflow Foundation 4.0 ActivityDesigner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆