如何在 Workflow Foundation 的自定义 Activity Designer 上设置自定义图标?

How to set custom Icon on Custom Activity Designer in Workflow Foundation?

我正在重新托管 .NET Framework 的工作流基础。我有一个 custom Activity。我试图指出我的 文件夹架构 以及 图标属性 .

的要点

我想要的是在我的自定义 activity 上显示一个自定义图标。 但是当我 运行 应用程序时,我收到了这个错误:

System.Windows.Markup.XamlParseException: ''Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '9' and line position '5'.'

我相信我设置 URL 不知何故不正确,但我尝试了很多我可以在互联网上找到的变体,但仍然无法让它工作。

我希望这里的图片能对我的问题有所帮助。

在下面添加这个就成功了:

<sap:ActivityDesigner.Icon>
        <DrawingBrush>
            <DrawingBrush.Drawing>
                <ImageDrawing>
                    <ImageDrawing.Rect>
                        <Rect Location="0,0" Size="16,16" ></Rect>
                    </ImageDrawing.Rect>
                    <ImageDrawing.ImageSource>
                        <BitmapImage UriSource="pack://application:,,,/Wpf.MainApp;component/Assets/Icons/icons8-data-grid-96.png"></BitmapImage>
                    </ImageDrawing.ImageSource>
                </ImageDrawing>
            </DrawingBrush.Drawing>
        </DrawingBrush>
    </sap:ActivityDesigner.Icon>