workflow-foundationactivitydesignerworkflow-rehosting

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


I am Re-Hosting the Workflow Foundation of .NET Framework. And I have a custom Activity. I tried to point out the key points of my folder architecture as well as the icon properties.

What I want is to display a custom icon on my custom activity. But when I run the app I'm getting this error:

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

I believe I'm setting the URL incorrectly somehow but I tried many variations I could find on the internet and still could not get it to work.

enter image description here

I'm hoping the image here shed some light on my problem.


Solution

  • Adding this below did the trick:

    <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>