HypernovaDesktop Components · docs
Binarymission
WPF › Project Management › PertChart

PertChart

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.ProjectManagement

A PERT chart: the plan as a network of boxes, one for each piece of work, joined by arrows in the order the work has to happen, each box showing the dates and float the critical-path method gives its task.

public partial class PertChart : Control

Inherits from / implements: Control

Remarks

Use it to see the logic of a plan rather than its calendar: which tasks wait for which, which can run side by side, and which chain of tasks – the critical path – decides when the plan finishes. It is the view to check a plan's dependencies in before committing to its dates.

The plan

The chart reads the same plan as a GanttChart and a TaskBoard: Tasks, a flat list of ProjectTask objects in which a subtask names its summary, and Links, the TaskLink dependencies between them. Give all three the same lists and they agree, because they schedule the same objects with the same arithmetic; a bar dragged on the Gantt chart moves the boxes here at once. Observable collections, and the tasks and links in them, are watched while the chart is loaded.

What a box shows

RowLeft, middle, right

Top

The task's name; a diamond before it marks a milestone.

Middle

Earliest start; length in working days (5d); earliest finish.

Bottom

Latest start; total float (3d float), or critical; latest finish.

A strip along the foot of the box fills with ProjectTask.Progress. With ShowCriticalPath on, critical boxes and the arrows between them are outlined in CriticalBrush, and so is a float below zero, which means the plan is already late.

The network

The boxes are the work – the tasks with no subtasks. A summary is not a box, but a link into a summary still leads to its subtasks that nothing else inside it waits for, and a link out of one leaves from those that nothing else inside it follows. Boxes stand in columns by how long the chain of links before them is, so every arrow runs forward, and arrows turn in the gaps between boxes, never through one. NodeWidth, NodeHeight, ColumnGap and RowGap size the layout; ZoomFactor scales it.

Moving about

The chart is one tab stop and shows the plan without changing it. Click a box to select it, drag the background to pan, turn the wheel to scroll (with Shift, sideways) and hold Ctrl with the wheel to zoom about the pointer. Right moves to the nearest task that follows, Left to the nearest it follows, Up and Down along a column, Home and End to the first and last box; Enter raises TaskActivated; Page Up and Page Down scroll; Ctrl+Plus and Ctrl+Minus zoom and Ctrl+0 returns to actual size. A tooltip, and a screen reader, say what a box means in words, including the tasks it follows and leads to.

Appearance

The chart draws itself and has no template. Boxes take Control.Background unless NodeBackgroundBrush is set, text takes Control.Foreground and the font, and dates are written in the culture of FrameworkElement.Language when it is set, otherwise the current culture. In Windows high contrast the system colours replace every brush. With FrameworkElement.FlowDirection right to left the network reads from right to left, and the arrow keys follow. ExportImage draws the whole network.

Examples

One plan in three views. The window's data context has Tasks and Links collections; choosing a task in any view chooses it in the others, because each view's SelectedTask is bound to the Gantt chart's.

<Window x:Class="Planner.PlanWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:pm="clr-namespace:Binarymission.WPF.Controls.ProjectManagement;assembly=Binarymission.WPF.Controls.ProjectManagement"
        Title="Website relaunch" Width="1200" Height="800">
    <TabControl>
        <TabItem Header="Schedule">
            <pm:GanttChart x:Name="gantt" Tasks="{Binding Tasks}" Links="{Binding Links}"
                           ProjectStart="2026-11-02" Zoom="Week" />
        </TabItem>
        <TabItem Header="Network">
            <pm:PertChart Tasks="{Binding Tasks}" Links="{Binding Links}"
                          ProjectStart="2026-11-02"
                          NodeWidth="200" ColumnGap="72"
                          SelectedTask="{Binding SelectedTask, ElementName=gantt}"
                          TaskActivated="OnTaskActivated" />
        </TabItem>
        <TabItem Header="Board">
            <pm:TaskBoard Tasks="{Binding Tasks}" Links="{Binding Links}"
                          ProjectStart="2026-11-02" LaneBy="Assignee"
                          SelectedTask="{Binding SelectedTask, ElementName=gantt}" />
        </TabItem>
    </TabControl>
</Window>

A PERT chart made in code, never shown, to save the network as a picture for a report.

var pert = new PertChart
{
    Tasks = plan.Tasks,                     // the application's ObservableCollection<ProjectTask>
    Links = plan.Links,
    ProjectStart = new DateTime(2026, 11, 2),
    NodeWidth = 210,
};

ProjectSchedule schedule = pert.Schedule;   // worked out from the plan as it is now
Console.WriteLine("Critical path: " + string.Join(" > ", schedule.CriticalPath));

BitmapSource image = pert.ExportImage(192);
var png = new PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(image));
using (FileStream file = File.Create("Network.png"))
    png.Save(file);

See also

Members at a glance

Constructors
PertChartCreates an empty PERT chart, with empty Tasks, Links and Holidays lists of its own and a Monday-to-Friday week.
Properties
ColumnGapGets or sets the space between one column of boxes and the next, where the arrows turn.
CriticalBrushGets or sets the colour of the critical path, while ShowCriticalPath is on: the outline of a critical box, the arrows between critical boxes, the word critical, and a float below zero.
HolidaysGets or sets the dates that are not worked, beside the days WorkingWeek leaves out.
LinkBrushGets or sets the colour of the arrows that are not on the critical path.
LinksGets or sets the links between the tasks, which decide the order of the boxes and the arrows between them.
NodeBackgroundBrushGets or sets the fill of every box.
NodeBorderBrushGets or sets the outline of a box that is not critical, and – fainter – the lines that divide a box into its cells and the track behind its progress strip.
NodeHeightGets or sets the height of every box.
NodeWidthGets or sets the width of every box.
ProgressBrushGets or sets the fill of the progress strip along the foot of a box, which fills from the left with the task's ProjectTask.Progress.
ProjectStartGets or sets the first day work on the plan can happen.
RowGapGets or sets the space between one row of boxes and the next, along which an arrow that skips a column runs.
ScheduleGets the plan as scheduled: every task's early and late dates, its float, the critical path, and what in the input could not be used.
SelectedTaskGets or sets the selected task: the box with the highlighted ring, which the arrow keys move from.
SelectionBrushGets or sets the colour of the ring round the selected box and of the arrows into and out of it, so its neighbours in the network can be traced.
ShowCriticalPathGets or sets whether the critical boxes, and the arrows between them, are outlined in CriticalBrush and marked critical.
TasksGets or sets the tasks of the plan: a flat list in outline order, in which a subtask names its summary through ProjectTask.ParentId.
TodayGets or sets the date the charts treat as today. A PERT chart has no timeline and draws nothing for it.
VisualChildrenCountGets the number of child elements: the vertical and the horizontal scroll bar. Everything else is drawn.
WorkingWeekGets or sets the days of the week on which work happens.
ZoomFactorGets or sets how large the network is drawn.
Methods
ArrangeOverridePlaces the scroll bars, which appear only when the network is larger than the chart, and carries out a fit or a scroll asked for before the chart had a size.
ExportImageDraws the whole network as an image, at its own size and a zoom of 1, whatever part of it is in view and whatever is selected.
GetEnumeratorGets the two scroll bars, as logical children, so that they take the chart's resources and styles.
GetVisualChildReturns one of the two scroll bars.
MeasureOverrideAsks for the network's size at the current ZoomFactor, or for the room available when that is less.
OnCreateAutomationPeerGives UI Automation the chart as a list of boxes, so that a screen reader can read and move through the network.
OnDpiChangedDraws the network again for a new display scale, so that its text is sharp on the new pixels.
OnGotKeyboardFocusShows the focus cue and tells a screen reader which box is current.
OnKeyDownCarries out the chart's keys: the arrows, Home and End move between boxes, Enter activates the selected one, Page Up and Page Down scroll, and Ctrl with Plus, Minus or 0 zooms in, out, or back to actual size.
OnLostKeyboardFocusTakes the focus cue away when the chart loses the keyboard.
OnLostMouseCaptureEnds a pan when something else takes the mouse, such as another window coming to the front.
OnMouseLeaveHides the tooltip when the pointer leaves the chart.
OnMouseLeftButtonDownSelects the box under the pointer, raising TaskActivated on a double-click, or starts panning when the press is on the background.
OnMouseLeftButtonUpEnds a pan.
OnMouseMovePans while the background is dragged; otherwise shows, after the hover time, a tooltip saying in words what the box under the pointer means.
OnMouseWheelScrolls up and down, 48 logical units a notch; with Shift, scrolls sideways; with Ctrl, zooms about the pointer, by a factor of 1.2 a notch.
OnPropertyChangedRedraws when a setting the drawing reads from the control itself changes: the font, Foreground, Background, FrameworkElement.Language, FrameworkElement.FlowDirection or the text formatting mode.
OnQueryCursorShows a hand over a box, which can be chosen, and a four-way arrow while panning.
OnRenderDraws the chart: the network under the current scroll and zoom, then the selected box, its arrows and the focus cue over it.
RescheduleSchedules the plan again now and redraws.
ScrollToTaskScrolls the view, as little as it needs to, so that a task's box is in it with a margin round it.
ZoomInDraws the network a fifth larger (ZoomFactor times 1.2, up to 3), keeping the middle of the view where it is.
ZoomOutDraws the network smaller (ZoomFactor divided by 1.2, down to 0.25), keeping the middle of the view where it is.
ZoomToFitSets the ZoomFactor at which the whole network fits the chart, within 0.25 to 3, and scrolls to its start.
Events
ScheduleChangedOccurs after the plan has been scheduled again because something changed: a task, a link, one of the lists, or a scheduling setting.
SelectedTaskChangedOccurs when SelectedTask changes: the reader chose another box, the application set the property, or the selected task left the plan.
TaskActivatedOccurs when the reader asks to open a task: by double-clicking its box, or by pressing Enter on the selected box.
ZoomFactorChangedOccurs when ZoomFactor changes: set by the application, or by the reader with Ctrl and the wheel, Ctrl+Plus, Ctrl+Minus or Ctrl+0.
Fields
ColumnGapPropertyIdentifies the ColumnGap dependency property.
CriticalBrushPropertyIdentifies the CriticalBrush dependency property.
HolidaysPropertyIdentifies the Holidays dependency property.
LinkBrushPropertyIdentifies the LinkBrush dependency property.
LinksPropertyIdentifies the Links dependency property.
NodeBackgroundBrushPropertyIdentifies the NodeBackgroundBrush dependency property.
NodeBorderBrushPropertyIdentifies the NodeBorderBrush dependency property.
NodeHeightPropertyIdentifies the NodeHeight dependency property.
NodeWidthPropertyIdentifies the NodeWidth dependency property.
ProgressBrushPropertyIdentifies the ProgressBrush dependency property.
ProjectStartPropertyIdentifies the ProjectStart dependency property.
RowGapPropertyIdentifies the RowGap dependency property.
SelectedTaskPropertyIdentifies the SelectedTask dependency property.
SelectionBrushPropertyIdentifies the SelectionBrush dependency property.
ShowCriticalPathPropertyIdentifies the ShowCriticalPath dependency property.
TasksPropertyIdentifies the Tasks dependency property.
TodayPropertyIdentifies the Today dependency property.
WorkingWeekPropertyIdentifies the WorkingWeek dependency property.
ZoomFactorPropertyIdentifies the ZoomFactor dependency property.

Constructors

PertChart

public PertChart()

Creates an empty PERT chart, with empty Tasks, Links and Holidays lists of its own and a Monday-to-Friday week.

Remarks

Each chart gets lists of its own, so adding a task to one chart never adds it to another. To share a plan, give several charts the same lists.

Properties

ColumnGap

public double ColumnGap

Gets or sets the space between one column of boxes and the next, where the arrows turn.

Value
In logical units (1/96 inch). The default is 64; it is never drawn less than 24.
Remarks

Widen it when many arrows leave one column. A negative value, NaN or an infinity is refused with an ArgumentException.

CriticalBrush

public Brush CriticalBrush

Gets or sets the colour of the critical path, while ShowCriticalPath is on: the outline of a critical box, the arrows between critical boxes, the word critical, and a float below zero.

Value
The default is a red-orange, #E0512B. null uses the system's hot-track colour.
Remarks

In Windows high contrast the system colours are used instead.

Holidays

public IList<DateTime> Holidays

Gets or sets the dates that are not worked, beside the days WorkingWeek leaves out.

Value
Only the date part of each is read. The default is an empty list of the chart's own; setting null gives a new empty one.
Remarks

An ObservableCollection is watched, so adding a date moves the dates in the boxes at once. Give every view of a plan the same holidays, or their dates will disagree.

LinkBrush

public Brush LinkBrush

Gets or sets the colour of the arrows that are not on the critical path.

Value
The default is a grey, #7B8794. null uses the system's dark control colour.
Remarks

The arrows into and out of the selected box are drawn in SelectionBrush. In Windows high contrast the system colours are used instead.

NodeBackgroundBrush

public Brush NodeBackgroundBrush

Gets or sets the fill of every box.

Value
The default is null: boxes take the chart's Background, or the system window colour when that is not set, so they follow a light or a dark theme.
Remarks

Text in a box is drawn in Foreground; choose a fill it reads on. In Windows high contrast the system colours are used instead.

Example
<pm:PertChart Background="#F4F6F8" NodeBackgroundBrush="White" NodeBorderBrush="#B0BAC5"
              CriticalBrush="#C62828" ProgressBrush="#2E7D32" />

NodeBorderBrush

public Brush NodeBorderBrush

Gets or sets the outline of a box that is not critical, and – fainter – the lines that divide a box into its cells and the track behind its progress strip.

Value
The default is a mid grey, #8A96A3, which reads on light and dark backgrounds alike. null uses the system's dark control colour.
Remarks

In Windows high contrast the system colours are used instead.

NodeHeight

public double NodeHeight

Gets or sets the height of every box.

Value
In logical units (1/96 inch) at a ZoomFactor of 1. The default is 92. A box is never drawn shorter than 48, the least that holds its three rows of text.
Remarks

A negative value, NaN or an infinity is refused with an ArgumentException.

NodeWidth

public double NodeWidth

Gets or sets the width of every box.

Value
In logical units (1/96 inch) at a ZoomFactor of 1. The default is 188. A box is never drawn narrower than 80, the least that holds three short dates side by side.
Remarks

A long task name is cut short with an ellipsis; widen the boxes to show more of it. A negative value, NaN or an infinity is refused with an ArgumentException.

See also

ProgressBrush

public Brush ProgressBrush

Gets or sets the fill of the progress strip along the foot of a box, which fills from the left with the task's ProjectTask.Progress.

Value
The default is a calm blue, #3B7DD8. null uses the system highlight colour.
Remarks

In Windows high contrast the system colours are used instead.

ProjectStart

public DateTime? ProjectStart

Gets or sets the first day work on the plan can happen.

Value
The first possible day, or null to start at the earliest planned date among the tasks, or today when none has one. The default is null.
Remarks

A date that is not worked is read as the next working day.

RowGap

public double RowGap

Gets or sets the space between one row of boxes and the next, along which an arrow that skips a column runs.

Value
In logical units (1/96 inch). The default is 28; it is never drawn less than 8.
Remarks

A negative value, NaN or an infinity is refused with an ArgumentException.

Schedule

public ProjectSchedule Schedule

Gets the plan as scheduled: every task's early and late dates, its float, the critical path, and what in the input could not be used.

Value
The current schedule; never null.
Remarks

The plan is scheduled again first when anything has changed. A chart that is not loaded is not listening to its plan, so it schedules afresh each time this is read – which is what lets a chart that is never shown answer from the plan as it is now.

See also

SelectedTask

public ProjectTask SelectedTask

Gets or sets the selected task: the box with the highlighted ring, which the arrow keys move from.

Value
A task that is a box of this chart, or null for none; the default. It binds two-way by default.
Remarks

Setting a summary, or a task not in Tasks, highlights no box, and the property is cleared the next time the plan is scheduled. When the list is replaced, the selection moves to the task that now has the selected task's id, if there is one. Selecting does not scroll; call ScrollToTask for that.

See also

SelectionBrush

public Brush SelectionBrush

Gets or sets the colour of the ring round the selected box and of the arrows into and out of it, so its neighbours in the network can be traced.

Value
The default is null: the system highlight colour.
Remarks

In Windows high contrast the system colours are used instead.

ShowCriticalPath

public bool ShowCriticalPath

Gets or sets whether the critical boxes, and the arrows between them, are outlined in CriticalBrush and marked critical.

Value
The default is true.
Remarks

Turning it off changes only the drawing; the critical tasks are still in ProjectSchedule.CriticalPath.

Tasks

public IList<ProjectTask> Tasks

Gets or sets the tasks of the plan: a flat list in outline order, in which a subtask names its summary through ProjectTask.ParentId.

Value
The tasks to schedule and draw. The default is an empty list of the chart's own; setting null gives the chart a new empty list, so it is never null.
Remarks

Every task with no subtasks is a box; a summary is not. While the chart is loaded, an ObservableCollection or a BindingList<T> is watched, and so is every task in it. A plain List<T> is read when it is assigned; call Reschedule after changing one.

See also

Today

public DateTime? Today

Gets or sets the date the charts treat as today. A PERT chart has no timeline and draws nothing for it.

Value
The default is null, the computer's date.
Remarks

It is here so that the same settings can be given to a GanttChart, which draws its today line there, a PERT chart and a TaskBoard alike, by one style or one binding.

VisualChildrenCount

protected override int VisualChildrenCount

Gets the number of child elements: the vertical and the horizontal scroll bar. Everything else is drawn.

Value
Always 2.

WorkingWeek

public WorkingWeek WorkingWeek

Gets or sets the days of the week on which work happens.

Value
The default is WorkingWeek.Weekdays, Monday to Friday; WorkingWeek.None is read as every day.
Remarks

Durations and float are counted in these working days. In XAML: WorkingWeek="Monday, Tuesday, Wednesday, Thursday".

ZoomFactor

public double ZoomFactor

Gets or sets how large the network is drawn.

Value
A scale, where 1 is the size NodeWidth and the other metrics give. The default is 1. Values are kept between 0.25 and 3; zero, a negative value, NaN or an infinity is refused with an ArgumentException. It binds two-way by default.
Remarks

A change keeps the middle of the view (or the point under the pointer, for Ctrl and the wheel) where it is on screen, and raises ZoomFactorChanged.

Example
<Slider Minimum="0.25" Maximum="3" Value="{Binding ZoomFactor, ElementName=pert}" />
<pm:PertChart x:Name="pert" Tasks="{Binding Tasks}" Links="{Binding Links}" />
See also

Methods

ArrangeOverride

protected override Size ArrangeOverride(Size arrangeBounds)

Places the scroll bars, which appear only when the network is larger than the chart, and carries out a fit or a scroll asked for before the chart had a size.

Parameters
arrangeBounds
The size the chart has been given.
Returns

arrangeBounds: the chart uses all of it.

ExportImage

public BitmapSource ExportImage(double dpi

Draws the whole network as an image, at its own size and a zoom of 1, whatever part of it is in view and whatever is selected.

Parameters
dpi
The resolution in dots per inch; 96, the default, gives one pixel per logical unit, and 192 an image twice as sharp for print.
Returns

The image, frozen, so that it can be saved or handed to another thread.

Exceptions
ArgumentOutOfRangeException
dpi is not a positive number.
Remarks

The image uses the chart's colours, font and reading direction. The chart need not be on screen: one made only for exporting reads its plan afresh. An empty plan gives a small image that says "No tasks".

An image that would be wider or taller than 16,384 pixels, or larger than 128 megapixels, is made at the highest resolution below dpi that fits; its DpiX says which.

GetEnumerator

protected override IEnumerator LogicalChildren

Gets the two scroll bars, as logical children, so that they take the chart's resources and styles.

Value
An enumerator over the vertical and the horizontal scroll bar.

GetVisualChild

protected override Visual GetVisualChild(int index)

Returns one of the two scroll bars.

Parameters
index
0 for the vertical scroll bar, 1 for the horizontal one.
Returns

The scroll bar.

Exceptions
ArgumentOutOfRangeException
index is not 0 or 1.

MeasureOverride

protected override Size MeasureOverride(Size constraint)

Asks for the network's size at the current ZoomFactor, or for the room available when that is less.

Parameters
constraint
The room available, in logical units; either side may be infinite.
Returns

The size wanted. An empty plan asks for 240 by 120, room for its "No tasks" message.

OnCreateAutomationPeer

protected override AutomationPeer OnCreateAutomationPeer()

Gives UI Automation the chart as a list of boxes, so that a screen reader can read and move through the network.

Returns

The chart's automation peer.

Remarks

Each box is a list item named with what it shows in words – its dates, length, float or that it is critical, and the tasks it follows and leads to – and can be selected, scrolled into view and invoked, which raises TaskActivated.

OnDpiChanged

protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)

Draws the network again for a new display scale, so that its text is sharp on the new pixels.

Parameters
oldDpi
The scale before.
newDpi
The scale now.

OnGotKeyboardFocus

protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)

Shows the focus cue and tells a screen reader which box is current.

Parameters
e
The event data.

OnKeyDown

protected override void OnKeyDown(KeyEventArgs e)

Carries out the chart's keys: the arrows, Home and End move between boxes, Enter activates the selected one, Page Up and Page Down scroll, and Ctrl with Plus, Minus or 0 zooms in, out, or back to actual size.

Parameters
e
The key. Every arrow is marked handled, even at the edge of the network, so it never moves the focus out of the chart.
Remarks

Right goes to the nearest task that follows the selected one, Left to the nearest it follows, Up and Down along its column. With FrameworkElement.FlowDirection right to left, Left and Right swap. With nothing selected, the first key selects the first box, or for End the last.

OnLostKeyboardFocus

protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)

Takes the focus cue away when the chart loses the keyboard.

Parameters
e
The event data.

OnLostMouseCapture

protected override void OnLostMouseCapture(MouseEventArgs e)

Ends a pan when something else takes the mouse, such as another window coming to the front.

Parameters
e
The event data.

OnMouseLeave

protected override void OnMouseLeave(MouseEventArgs e)

Hides the tooltip when the pointer leaves the chart.

Parameters
e
The event data.

OnMouseLeftButtonDown

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)

Selects the box under the pointer, raising TaskActivated on a double-click, or starts panning when the press is on the background.

Parameters
e
The press.

OnMouseLeftButtonUp

protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)

Ends a pan.

Parameters
e
The release.

OnMouseMove

protected override void OnMouseMove(MouseEventArgs e)

Pans while the background is dragged; otherwise shows, after the hover time, a tooltip saying in words what the box under the pointer means.

Parameters
e
The move.

OnMouseWheel

protected override void OnMouseWheel(MouseWheelEventArgs e)

Scrolls up and down, 48 logical units a notch; with Shift, scrolls sideways; with Ctrl, zooms about the pointer, by a factor of 1.2 a notch.

Parameters
e
The wheel turn.

OnPropertyChanged

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)

Redraws when a setting the drawing reads from the control itself changes: the font, Foreground, Background, FrameworkElement.Language, FrameworkElement.FlowDirection or the text formatting mode.

Parameters
e
The property that changed, with its old and new values.
Remarks

An override should call the base implementation.

OnQueryCursor

protected override void OnQueryCursor(QueryCursorEventArgs e)

Shows a hand over a box, which can be chosen, and a four-way arrow while panning.

Parameters
e
The event data.

OnRender

protected override void OnRender(DrawingContext drawingContext)

Draws the chart: the network under the current scroll and zoom, then the selected box, its arrows and the focus cue over it.

Parameters
drawingContext
Where to draw.

Reschedule

public void Reschedule()

Schedules the plan again now and redraws.

Remarks

Needed only after changing a plain List<T> or array, or a task in one; observable collections and the objects in them are watched. Objects newly added to a plain list are watched from here on. ScheduleChanged is raised before this returns.

ScrollToTask

public void ScrollToTask(ProjectTask task)

Scrolls the view, as little as it needs to, so that a task's box is in it with a margin round it.

Parameters
task
The task to show. Nothing happens for null, a summary, or a task that is not in the plan.
Remarks

The selection does not change. Called before the chart has a size, it waits for the first layout.

ZoomIn

public void ZoomIn()

Draws the network a fifth larger (ZoomFactor times 1.2, up to 3), keeping the middle of the view where it is.

ZoomOut

public void ZoomOut()

Draws the network smaller (ZoomFactor divided by 1.2, down to 0.25), keeping the middle of the view where it is.

ZoomToFit

public void ZoomToFit()

Sets the ZoomFactor at which the whole network fits the chart, within 0.25 to 3, and scrolls to its start.

Remarks

An empty plan is left as it is. Called before the chart has a size – from a constructor, say – it waits for the first layout and then fits.

Events

ScheduleChanged

public event EventHandler ScheduleChanged

Occurs after the plan has been scheduled again because something changed: a task, a link, one of the lists, or a scheduling setting.

Remarks

Changes arriving together are scheduled once and announced once, from the dispatcher, after they have all arrived; so a handler sees the finished result. Reschedule raises it before it returns. A chart that is not loaded does not raise it; nor does loading one, so read Schedule when the chart is loaded if you need the first result.

See also

SelectedTaskChanged

public event EventHandler SelectedTaskChanged

Occurs when SelectedTask changes: the reader chose another box, the application set the property, or the selected task left the plan.

See also

TaskActivated

public event EventHandler<TaskEventArgs> TaskActivated

Occurs when the reader asks to open a task: by double-clicking its box, or by pressing Enter on the selected box.

Remarks

The chart does nothing else with it; it is the place to open the task's details or switch to it in a GanttChart. The box is already selected.

Example
pert.TaskActivated += (sender, e) =>
{
    tabs.SelectedItem = scheduleTab;      // show the Gantt chart...
    gantt.SelectedTask = e.Task;          // ...on the same task
    gantt.ScrollToTask(e.Task);
};

ZoomFactorChanged

public event EventHandler ZoomFactorChanged

Occurs when ZoomFactor changes: set by the application, or by the reader with Ctrl and the wheel, Ctrl+Plus, Ctrl+Minus or Ctrl+0.

Example
pert.ZoomFactorChanged += (sender, e) => zoomText.Text = pert.ZoomFactor.ToString("P0");

Fields

ColumnGapProperty static

public static readonly DependencyProperty ColumnGapProperty

Identifies the ColumnGap dependency property.

CriticalBrushProperty static

public static readonly DependencyProperty CriticalBrushProperty

Identifies the CriticalBrush dependency property.

HolidaysProperty static

public static readonly DependencyProperty HolidaysProperty

Identifies the Holidays dependency property.

LinkBrushProperty static

public static readonly DependencyProperty LinkBrushProperty

Identifies the LinkBrush dependency property.

LinksProperty static

public static readonly DependencyProperty LinksProperty

Identifies the Links dependency property.

NodeBackgroundBrushProperty static

public static readonly DependencyProperty NodeBackgroundBrushProperty

Identifies the NodeBackgroundBrush dependency property.

NodeBorderBrushProperty static

public static readonly DependencyProperty NodeBorderBrushProperty

Identifies the NodeBorderBrush dependency property.

NodeHeightProperty static

public static readonly DependencyProperty NodeHeightProperty

Identifies the NodeHeight dependency property.

NodeWidthProperty static

public static readonly DependencyProperty NodeWidthProperty

Identifies the NodeWidth dependency property.

ProgressBrushProperty static

public static readonly DependencyProperty ProgressBrushProperty

Identifies the ProgressBrush dependency property.

ProjectStartProperty static

public static readonly DependencyProperty ProjectStartProperty

Identifies the ProjectStart dependency property.

RowGapProperty static

public static readonly DependencyProperty RowGapProperty

Identifies the RowGap dependency property.

SelectedTaskProperty static

public static readonly DependencyProperty SelectedTaskProperty

Identifies the SelectedTask dependency property.

SelectionBrushProperty static

public static readonly DependencyProperty SelectionBrushProperty

Identifies the SelectionBrush dependency property.

ShowCriticalPathProperty static

public static readonly DependencyProperty ShowCriticalPathProperty

Identifies the ShowCriticalPath dependency property.

TasksProperty static

public static readonly DependencyProperty TasksProperty

Identifies the Tasks dependency property.

TodayProperty static

public static readonly DependencyProperty TodayProperty

Identifies the Today dependency property.

WorkingWeekProperty static

public static readonly DependencyProperty WorkingWeekProperty

Identifies the WorkingWeek dependency property.

ZoomFactorProperty static

public static readonly DependencyProperty ZoomFactorProperty

Identifies the ZoomFactor dependency property.