代码如下在Activity里面
public sealed class ComparisonActivity : AsyncCodeActivity, IRegisterMetadata
{
//属性
public string SourceImgPath { get; set; }
...............
protected override void Execute(CodeActivityContext context)
{
SourceImgPath =“.../../1.png”;
//在此执行的时候更改SourceImgPath 的路径,然后在在designer中显示改后的值,也就是显示图片
}
...............
}
在对应的ActivityDesigner的xaml里面绑定如下:
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="txtbSourceName" Text="{Binding Path=ModelItem.SourceImgPath,Mode=TwoWay,Converter={StaticResource covImgName}}" >
<TextBlock.ToolTip>
<Image Source="{Binding Path=ModelItem.SourceImgPath,Mode=TwoWay,Converter={StaticResource covImg}}"/>
</TextBlock.ToolTip>
</TextBlock>