[英]Is the designer source code for Windows Workflow Sequence activity available for reference?
[英]Add an image to a windows workflow custom activity designer
我正在使用设计器在Windows工作流中开发一些自定义活动,以为用户添加一些不错的自定义外观。 尽管我在实际的工作流视图中加载图像时遇到问题,但我几乎能够执行WPF中的所有操作。 这就是设计师的外观
<sap:ActivityDesigner.Resources>
<DataTemplate x:Key="Collapsed">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition MaxWidth="40"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image MaxWidth="40" MaxHeight="20" Grid.Column="0" HorizontalAlignment="Left" Source="pack://application:,,,/Images/Web.ico"></Image>
<Label VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Grid.Column="1">Collapsed View</Label>
</Grid>
</DataTemplate>
<DataTemplate x:Key="Expanded">
<Grid>
<Label>hi</Label>
</Grid>
</DataTemplate>
<Style x:Key="ExpandOrCollapsedStyle" TargetType="{x:Type ContentPresenter}">
<Setter Property="ContentTemplate" Value="{DynamicResource Collapsed}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=ShowExpanded}" Value="true">
<Setter Property="ContentTemplate" Value="{DynamicResource Expanded}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</sap:ActivityDesigner.Resources>
<Grid>
<ContentPresenter Style="{DynamicResource ExpandOrCollapsedStyle}" Content="{Binding}" />
</Grid>
</sap:ActivityDesigner>
但是在Visual Studio 2015中创建工作流时,它看起来像这样:
我发现图像需要包含名称空间。 图片标签应类似于以下内容:
<Image MaxWidth="40" MaxHeight="20" Grid.Column="0" HorizontalAlignment="Left"
Source="pack://application:,,,/MyNamespace;component/Lookup.png"></Image>
Lookup.png的生成操作应为“资源”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.