开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜