Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:02:49+00:00 2026-06-13T18:02:49+00:00

I’ve created a a custom activity designer, but I wanted to have control over

  • 0

I’ve created a a custom activity designer, but I wanted to have control over the ‘header’ part (that by default shows the ModelItem.DisplayName), and as far I know, the only way to achieve this is to derive the designer from WorkflowViewElement rather than ActivityDesigner. So, that seems to work and all is well. Except, I want to support the new Annotations feature of WF4.5.
Given that when you add an annotation to a workflow element on the design surface it adds an icon to the element you are annotating + the actual annotation element, it seems clear that any custom WorkflowViewElement has to have some extra stuff in it to support this behaviour. Can anyone help?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:02:50+00:00Added an answer on June 13, 2026 at 6:02 pm

    As I thought, annotations are saved within the workflow definition as an attached property. Here’s what an annotation looks like in the workflow’s xaml:

    <Sequence
      xmlns:derp="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
      derp:Annotation.AnnotationText="This is an annotation!">
    

    See, just like any other attached property. Except it isn’t. Its an attached workflow property, not an attached DependencyProperty. That means it works through the attached property service as well as the Annotation class. Getting and setting the annotation text on a ModelItem is trivial (and covered below).

    Its actually not that hard to support annotations. As long as you don’t mind your UI looking like crap. Here’s a quick and dirty implementation.

    In the UI, add some controls for holding and editing the annotation text

    <sap:WorkflowViewElement
        x:Class="AnnotationSupport.MyActivityDesigner"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
        xmlns:ann="clr-namespace:System.Activities.Presentation.Annotations;assembly=System.Activities.Presentation"
        xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
        x:Name="root"
        MinWidth="100"
        MinHeight="100">
        <Grid Background="red">
            <Grid.RowDefinitions>
                <RowDefinition
                    Height="auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Expander
                IsExpanded="False">          
                <!-- HERE SHE BLOWS -->
                <TextBox
                    Text="{Binding ModelItem.AnnotationText}" />
            </Expander>
                <TextBox
                Grid.Row="1"
                Text="{Binding ModelItem.Text}"
                Margin="10" />
        </Grid>
    </sap:WorkflowViewElement>
    

    Any time the Annotation text changes, the ModelItem’s PropertyChanged event fires, just like any other property. And if you want to grab it from code, the simplest way is to cast the ModelItem to a dynamic:

    private void SetAnnotationLol(string newValue)
    {
        if(ModelItem != null)
            ((dynamic)ModelItem).AnnotationText = newValue;
    }
    

    Now, if you want to create a nice UI like the Fx Activities have… well…

    I’ll leave it up to you to create a custom Adorner to handle display and editing of the annotation. Which actually isn’t as hard as it first looks. If you haven’t done one yet, here’s your opportunity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.