views:

103

answers:

1

Hi all,

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);
    }
}
+1  A: 

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.

AnthonyWJones
+1 for contribution again! thanks.
kevchadders