2

I need to create a UserControl, or a View, in WPF, that will be able to show, like in a calendar, days in the header, and a list of users vertically, and for each user like a planning bar placed inside a grid, below the days, that will show how many days the plan is taking. It's something like Gantt views, available from Telerik, or DevExpress, but I'm not allowed to use any paid sources/controls/toolkits. The problem is that I don't know how to start, what are the layouts that must be used, what controls etc.

Like here: enter image description here

I tried to create a ListView vertically, with ItemsSource horizontally for every user, but in such case I need binding for every row, even if the user hasn't anything planned for that period, so it will result in too many useless bindings, and this solution is also not adjustable to the screen size, except if you change the number of elements you bind to.

I need to show something only there where data exists, and in a manner similar to the image. It means that I need a container control, that will include the header and the swimlanes over which the planning will be shown.

Also, the width must be adjustable, so more screen the user has, more days horizontally will be visible.

How can I create that? What Controls, over which controls I must use?

I expect an answer something like in the following example: Container control: ListView horizontal Swimlanes: GridView, or Canvas Bars: Simple Rectangles

Thank you in advance!

EDIT

I have found a timeline project. It is open-source, and with good examples. CodePlex Timeline project

4

2 回答 2

5

我会重新考虑第三方控制的事情;稳健地建造它比购买它要贵得多(取决于你的每小时成本)。

如果您想自己构建它,您将需要以下内容:

  • 内容水平和垂直滚动
  • 行和列中的标题分别垂直和水平滚动,与前一项同步。
  • 项目模板、连接器模板
  • 块之间的依赖管理形式(数据层次结构)。
  • 连接器的路由,它们需要位于单独的层中,因为它们跨越多个泳道。还需要合并多个箭头。
  • 等等

要求非常严格,为此您需要大量代码。

于 2013-11-14T09:46:57.910 回答
4

我想Bas Brekelmans上面的第二个回应。您无法在任何合理的时间/成本内构建您在屏幕截图中显示的所有内容(依赖项、缩放时间线、进度、调整大小以适应等)。既然已经完成了,为什么还要重新发明轮子?

RadiantQ 的 WPF 甘特图是一个非常全面的软件包,可以让您实现上面提到的所有内容,包括不同的行高、假期等。看看他们的在线演示,它基于 Silverlight,但具有类似于 WPF 甘特图的功能。

当然,您可以下载试用版。

于 2013-11-14T14:14:51.707 回答