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

  • SEARCH
  • Home
  • 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 5957699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:26:18+00:00 2026-05-22T18:26:18+00:00

workflows seem to be created straight from Xaml. How then is would it be

  • 0

workflows seem to be created straight from Xaml. How then is would it be possible to include a System.Attribute on my workflow classes?

The only ways i can think of are a bit crap:

Have a corresponding code file for each Activity.xaml:

[MyCustomAttribute("hello")]
public abstract class MyPointlessWorkflowBase : System.Activity
{

}

And then having my .xaml inherit from the base (i don’t even know if this is possible)? But this sucks as i have to an extra class for each Workflow that requires the attribute.

is there anyway to code activities like they were normal classes before you slap the .xaml over it?

  • 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-05-22T18:26:19+00:00Added an answer on May 22, 2026 at 6:26 pm

    A XAML file generates a class with a partial keyword before it gets compiled so you can create a partial class with the same name and add the attribute there.

    [MyCustomAttribute("hello")]
    public partial class MyWorkflow : Activity
    {
    }
    

    Alternatively you can add an attribute in XAML using the x:ClassAttributes element and add them that way.

    <p:Activity x:Class="WorkflowConsoleApplication1.MyWorkflow"
                xmlns:s="clr-namespace:System;assembly=mscorlib"
                xmlns:my="......"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
        <x:ClassAttributes>
          <my:MyCustomAttribute>
            <x:Arguments>
              <s:String>hello</s:String>
            </x:Arguments>
          </my:MyCustomAttribute>
        </x:ClassAttributes>
    </p:Activity>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty much all of the tutorials/introductions to Windows Workflow Foundation seem to be targeted
I've tried the various suggestions from other posts and still can't seem to get
For issues created in Jira, I cannot seem to update either Status or Resolution
I have Workflow Permissions configured but they don't seem to be working properly. I'm
I have created an Automator workflow service (not Automator application!) under Mac OS X
I'm using WF4 and have a workflow service in which I have created a
I would like some comments on the possibility or alternatives to the following workflow.
I need to add Workflows to an existing solution, which already contains a class
I have several workflows where the users want to set the number of days
I'm trying to develop some SharePoint workflows for the company I work for, and

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.