惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
W
WeLiveSecurity
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
D
Darknet – Hacking Tools, Hacker News & Cyber Security
N
News and Events Feed by Topic
P
Privacy & Cybersecurity Law Blog
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
H
Hacker News: Front Page
H
Heimdal Security Blog
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
Recorded Future
Recorded Future
阮一峰的网络日志
阮一峰的网络日志
T
Tor Project blog
D
DataBreaches.Net
V
Visual Studio Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
GbyAI
GbyAI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
The Hacker News
The Hacker News
A
Arctic Wolf
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
P
Proofpoint News Feed
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
Scott Helme
Scott Helme
酷 壳 – CoolShell
酷 壳 – CoolShell
SecWiki News
SecWiki News
The Cloudflare Blog
N
News and Events Feed by Topic
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
小众软件
小众软件
博客园 - Franky
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
Blog — PlanetScale
Blog — PlanetScale
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Attack and Defense Labs
Attack and Defense Labs
T
Threat Research - Cisco Blogs

博客园 - aimin

SharePoint Foundation中文档与文件、单据类型定制办法 SharePoint2010的牛刀:一、新的服务应用程序架构 Silverlight甘特图:四、树形DataGrid开发原理 Silverlight甘特图:三、甘特图面板开发原理 Silverlight甘特图:二、时间线开发原理 Silverlight甘特图:一、甘特图介绍及开发者之系统准备 SharePoint Silverlight Workspacer 1.0 Silverlight Gantt Chart 改进计划 为业务建模——MOSS的优势与劣势 招SharePoint人才必须看ASP.NET底子 杂谈项目中的那些事儿:计划与变化 杂谈项目中的那些事儿:人的力量 杂谈项目中的那些事儿:理想与现状 【转】7 Signs Your SharePoint Project Is in Trouble 【转】7 Keys to Microsoft SharePoint Success silverlight Gantt Chart Demo 谈谈代码设计 Show一下Silverlight写的GanttChart SharePoint特性一览
Silverlight甘特图:五、Gantt图控件[已开源发布Codeplex]
aimin · 2012-01-29 · via 博客园 - aimin

如果说TimeLine,GanttPanel,TreeGrid是甘特图控件的三个核心部件,那么Gantt则是这三个部件之间行为和数据的协调者,Gantt统一了这三个部件的接口,提供了更简洁的开发能力。

架构提要:

功能:

ganttfunctions

设计:

design

在*.Gantt.Core 程序集中,可以发现大量的以Layout和Descriptor作为结尾的命名类,这些类构件了GanttPanel和TimeLine的计算模型和数据模型。

TimeLineViewer和TaskEntryViewer分别作为TimeLine和GanttPanel的视图层。Viewer类会调用Renderer进行渲染。

1. 语法

1.1. XAML

2. 备注

2.1. 设置数据源

甘特图控件目前仅支持特定的数据源格式: ObservableCollection<ITaskDescriptor>。其中ITaskDescriptor是单任务信息的数据接口,详细信息参考Class Library中内容。

因此,面对来自不同类型数据源的任务信息,开发者必须编写解析类或方法,将XML,JSON等类型的数据转化为甘特图指定的数据源类型。

除初始化设定数据源外,甘特图控件允许分步加载数据,这是通过OnRequestData事件响应来实现的。

激发OnRequestData事件的条件时,展开当前任务,任务的ITaskDescriptor.EnableExpand=true,但ITaskDescriptor.Children.Count = 0;

示例代码如下:

1) 事件处理函数逻辑

   1: ObservableCollection<ITaskDescriptor> Gantt_OnRequestData(object sender, V2TEK.Silverlight.Charts.TreeGridHelper.RequestDataArgs args)
   2: {
   3:     return GetSimWCFData();
   4: }
   5:  
   6: public ObservableCollection<ITaskDescriptor> GetSimWCFData()
   7: {
   8:     return new ObservableCollection<ITaskDescriptor>
   9:     {

10: new SimpleTaskDescriptor{ TaskName="--------Sub Task 1", StartDate= DateTime.Now.AddMonths(4), EndDate=DateTime.Now.AddMonths(5), PercentComplete=25f,

TimeBaseLine=new SimpleTimeImpl{ StartDate=DateTime.Now.AddMonths(1), EndDate=DateTime.Now.AddMonths(10)} },

  11:         new SimpleTaskDescriptor{ TaskName="--------Sub Task 2", StartDate= DateTime.Now.AddMonths(2), EndDate=DateTime.Now.AddMonths(3), PercentComplete=50f },
  12:         new SimpleTaskDescriptor{ TaskName="--------Sub Task 3", StartDate= DateTime.Now.AddMonths(3), EndDate=DateTime.Now.AddMonths(5), PercentComplete=75f },
  13:         new SimpleTaskDescriptor{ TaskName="--------Sub Task 4", StartDate= DateTime.Now.AddMonths(5), EndDate=DateTime.Now.AddMonths(10),  PercentComplete=100f }
  14:     };
  15: }

2.2. 导航

导航指从指定任务的开始时间,或指定时间开始绘制甘特图,免于使用滚动条搜寻。

1) 导航到指定任务

NavigateTo(ITaskDescriptor task)

2) 导航到选中任务

NavigateToSeleteItem()

3) 导航到当前时间

NavigateToCurrentDate()

4) 导航到指定时间

NavigateToDate(DateTime date)

2.3. 放大/缩小

根据TimeLine中定义的时间轴分级缩放机制逐级放大或缩小,提供了三个接口:

1) ZoomOut()

放大到下一级

2) ZoomIn()

缩小至上一级

3) ZoomToIndex(int index)

缩放至指定级别, Index即Dictionary<IDateTimeDescriptor, int>的索引。

此外,Gantt允许设置TimeLineSummaryDescriptors和TimeLineDetailDescriptors属性值。

1) TimeLineSummaryDescriptors是上层时间轴的缩放分级定义。

2) TimeLineDetailDescriptors是下层时间轴的缩放分级定义。

2.4. 布局

除了通过以上接口更新Gantt的布局外,还可以通过下面的接口实现更为细致的布局更新。

Gantt提供了诸如XPosition,YPosition,GanttViewPortHeight,GanttViewPortWidth等布局的设定接口。在修改了这些布局属性值后,须调用Update方法。当然,也可以分别调用GanttPanel.Update(), TreeGrid.Update, TimeLine.Update, 前提是开发者能够确定需要更新那个子控件的布局。