简体   繁体   中英

Add sub categories to a Dependency Property in a Workflow Activity

I wish to create an workflow activity that has a dependancy property structure like this

  • Setting
    • Wait Period
      • Days
      • Hours
      • Mins

At the moment the code below will show Setting with the Wait Period as an Integer, but now need to expand it out to 3 sub child properties for Days , Hours and Mins .

I understand i will have to change the Wait Period , but i'm not sure how to go about attaching the other 3 properties to it.

Any help would be appreciated... Thanks.

public static DependencyProperty WaitPeriodProperty = DependencyProperty.Register("WaitPeriod", typeof(int), typeof(CheckActivity));
/// <summary>
/// Dependency property for 'Wait Period'
/// </summary>   
///        
[DescriptionAttribute("The email of the sender")]
[CategoryAttribute("Settings")]        
public int WaitPeriod
{
    get
    {
        return (int)(base.GetValue(CheckActivity.WaitPeriodProperty));
    }
    set
    {
        base.SetValue(CheckActivity.WaitPeriodProperty, value);
    }
}

First of all you should definitely change the type from int to TimeSpan . That has Days, Hours, Minutes, Seconds and Milliseconds.

The input UI may not be to your liking though its just a string: d.hh:mm:ss.msecs

However personally I would put up with that for the simplicity of using a Type specifically designed for the task. It might be possible to create a Custom editor for it though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM