将子类别添加到工作流活动中的依赖属性
我希望创建一个具有如下
- 设置 的依赖属性结构的工作流活动
- 等待期
- 天
- 时间
- 分钟
- 等待期
目前,下面的代码将显示设置,其中等待期为整数,但现在需要将其扩展到 3 个子子属性分别为天、小时和分钟。
我知道我必须更改等待期,但我不确定如何将其他 3 个属性附加到它。
任何帮助将不胜感激...谢谢。
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);
}
}
I wish to create an workflow activity that has a dependancy property structure like this
- Setting
- Wait Period
- Days
- Hours
- Mins
- Wait Period
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);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您绝对应该将类型从
int
更改为TimeSpan
。有天、小时、分钟、秒和毫秒。输入 UI 可能不符合您的喜好,尽管它只是一个字符串: d.hh:mm:ss.msecs
但就我个人而言,为了简单地使用专门为该任务设计的类型,我会忍受这一点。不过,也许可以为其创建一个自定义编辑器。
First of all you should definitely change the type from
int
toTimeSpan
. 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.