HypernovaDesktop Components · docs
Binarymission
WPF › Project Management › TaskBoard

TaskBoard

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

A task board: the plan as cards in columns, one column for each stage of the work and one card for each task, with lanes across the board by assignee, category or phase.

public partial class TaskBoard : Control

Inherits from / implements: Control

Remarks

A column is a value of Status and a lane is a value of the field LaneBy names, so moving a card changes those fields on the task itself, and a Gantt chart or PERT chart given the same Tasks sees the move. The board schedules the plan as well, so every card shows its finish date and whether it is critical. The board is one tab stop. The arrow keys move between cards; Space picks the current card up, the arrows then carry it - Up and Down within its column, Left and Right between columns, Shift with Up and Down between lanes - and Space or Enter drops it, or Escape puts it back. Enter on a card that is not carried raises TaskActivated. A card can also be dragged with the mouse, a pen or a finger.

Members at a glance

TaskBoardCreates an empty task board.
BadgeBrushThe disc behind an assignee's initials. A slate blue by default, under white initials.
CardBackgroundBrushThe fill of a card. Null, the default, fills cards with the board's Background, so that they follow a light or a dark theme.
CardBorderBrushThe outline of a card. A light grey by default.
CardHeightThe height of a card, in logical units. 76 by default, which holds two lines of name, the finish date and the assignee; a card is never drawn shorter than 52.
ColumnBackgroundBrushThe fill behind each column. A faint, partly transparent grey by default, which tints a light or a dark background alike.
ColumnWidthThe width of a column, in logical units (1/96 inch). 260 by default; a column is never drawn narrower than 180.
ColumnsThe columns, in order, each a Status value with an optional heading and work-in-progress limit. Empty, the default, makes a column of each status the tasks use, in the order they first appear. A task whose status has no column is shown in the first column. Never null.
CriticalBrushThe stripe along a critical card's leading edge. A red-orange by default.
HolidaysDates that are not worked, beside the days WorkingWeek leaves out. Never null; an observable collection is watched.
IsReadOnlyStops the reader moving cards; they can still be selected, activated and read. The application can still move them with MoveCard. False by default.
LaneByWhat the rows of the board are: none, the assignee, the category, or the phase. None by default.
LinksThe links between tasks, which decide each card's dates and whether it is critical. Never null; setting null gives the board an empty list of its own.
OverLimitBrushA column's count when it is over its limit, and a place a carried card would be refused. A deep orange by default.
ProgressBrushThe progress bar along the bottom of a card. A calm blue by default.
ProjectStartThe first day work can happen. Null starts the plan at its earliest planned date, or today when no task has one.
ScheduleThe plan as last scheduled: every task's dates, its float, and the critical path. Scheduled again first when anything has changed.
SelectedTaskThe selected task, which is also the card the arrow keys move from; null when none is. A task that is not a card - a summary, or one not in Tasks - selects nothing.
SelectionBrushThe outline of the selected and the carried card, and the mark showing where a carried card would land. Null, the default, uses the system's highlight colour.
ShowCriticalPathMarks each card on the critical path with a stripe in CriticalBrush. True by default.
StrictLimitsRefuses a card to a column that is already at its limit. False by default, when a column may go over its limit and says so in its heading.
TasksThe tasks: a flat list in outline order, each naming its parent. Summary tasks are not cards. Never null; setting null gives the board an empty list of its own.
TodayThe date the charts treat as today; null for the computer's own date. The Gantt chart draws its today line here. A board has no timeline and draws nothing for it; the property is here so that one set of settings can be given to all three charts alike.
VisualChildrenCountThe children are the two scroll bars; everything else is drawn.
WorkingWeekThe days of the week that are worked. Monday to Friday by default.
ArrangeOverridePlaces the scroll bars, which appear only when the board is larger than the view.
GetEnumeratorThe scroll bars, as logical children, so that they inherit the board's resources and font.
GetVisualChildReturns a scroll bar.
MeasureOverrideAsks for the whole board's size, or the space available when that is less.
MoveCardMoves a task's card, exactly as the reader would: CardMoving is raised first and can cancel it, and StrictLimits applies. The move is reported with Application as its source.
OnCreateAutomationPeerGives UI Automation the board as a list of headings and cards.
OnDpiChangedRedraws for a new screen density, so text is measured for the pixels it lands on.
OnGotKeyboardFocusShows the focus cue and tells a screen reader which card is current.
OnKeyDownThe arrows, Home and End move between cards; Space picks the current card up; Enter activates it; the page keys scroll. While a card is carried the arrows carry it, Space or Enter drops it and Escape puts it back.
OnLostKeyboardFocusA card carried from the keyboard is put back when the board loses the keyboard: the reader can no longer see or steer where it would go.
OnLostMouseCaptureA drag ends without a move if something else takes the mouse - a window coming to the front, or the application capturing it.
OnMouseLeaveHides the tooltip when the pointer leaves the board.
OnMouseLeftButtonDownSelects the card under the pointer; a double-click activates it, and a drag can follow.
OnMouseLeftButtonUpDrops a dragged card where the pointer is; a press that never became a drag was just a click.
OnMouseMoveStarts a drag once the pointer has moved far enough, then carries the card; otherwise follows the pointer for the tooltip.
OnMouseWheelScrolls down and up; with Shift, across.
OnPropertyChangedDrops what was resolved from the inherited text and colour settings - the font, the foreground, the background, the language, the reading direction and the text formatting mode - when one changes.
OnQueryCursorA hand over a card that can be moved and while one is dragged; "not allowed" over a place that refuses it.
OnRenderDraws the board: headings over the scrolling body, then a dragged card's copy over both.
RescheduleSchedules the plan again now and redraws. Needed only after changing a plain list that does not say when it changes, a task in one, or a BoardColumn's properties.
ScrollToTaskScrolls the board, as little as it needs to, so that a task's card is in view. Nothing happens for a task that is not a card.
CardMovedRaised after a card has moved and its task has been changed.
CardMovingRaised before a card moves, by the pointer, the keyboard or MoveCard. Cancel it to keep the card where it is; nothing has changed yet.
ScheduleChangedRaised after the plan has been scheduled again because something changed: a task, a link, a collection, or one of the scheduling settings.
SelectedTaskChangedRaised when SelectedTask changes, by the reader or by the application.
TaskActivatedRaised when the reader double-clicks a card, or presses Enter on the current one.
BadgeBrushPropertyIdentifies the BadgeBrush dependency property.
CardBackgroundBrushPropertyIdentifies the CardBackgroundBrush dependency property.
CardBorderBrushPropertyIdentifies the CardBorderBrush dependency property.
CardHeightPropertyIdentifies the CardHeight dependency property.
ColumnBackgroundBrushPropertyIdentifies the ColumnBackgroundBrush dependency property.
ColumnWidthPropertyIdentifies the ColumnWidth dependency property.
ColumnsPropertyIdentifies the Columns dependency property.
CriticalBrushPropertyIdentifies the CriticalBrush dependency property.
HolidaysPropertyIdentifies the Holidays dependency property.
IsReadOnlyPropertyIdentifies the IsReadOnly dependency property.
LaneByPropertyIdentifies the LaneBy dependency property.
LinksPropertyIdentifies the Links dependency property.
OverLimitBrushPropertyIdentifies the OverLimitBrush dependency property.
ProgressBrushPropertyIdentifies the ProgressBrush dependency property.
ProjectStartPropertyIdentifies the ProjectStart dependency property.
SelectedTaskPropertyIdentifies the SelectedTask dependency property.
SelectionBrushPropertyIdentifies the SelectionBrush dependency property.
ShowCriticalPathPropertyIdentifies the ShowCriticalPath dependency property.
StrictLimitsPropertyIdentifies the StrictLimits dependency property.
TasksPropertyIdentifies the Tasks dependency property.
TodayPropertyIdentifies the Today dependency property.
WorkingWeekPropertyIdentifies the WorkingWeek dependency property.

Constructors

TaskBoard

public TaskBoard()

Creates an empty task board.

Properties

BadgeBrush

public Brush BadgeBrush

The disc behind an assignee's initials. A slate blue by default, under white initials.

CardBackgroundBrush

public Brush CardBackgroundBrush

The fill of a card. Null, the default, fills cards with the board's Background, so that they follow a light or a dark theme.

CardBorderBrush

public Brush CardBorderBrush

The outline of a card. A light grey by default.

CardHeight

public double CardHeight

The height of a card, in logical units. 76 by default, which holds two lines of name, the finish date and the assignee; a card is never drawn shorter than 52.

ColumnBackgroundBrush

public Brush ColumnBackgroundBrush

The fill behind each column. A faint, partly transparent grey by default, which tints a light or a dark background alike.

ColumnWidth

public double ColumnWidth

The width of a column, in logical units (1/96 inch). 260 by default; a column is never drawn narrower than 180.

Columns

public ObservableCollection<BoardColumn> Columns

The columns, in order, each a Status value with an optional heading and work-in-progress limit. Empty, the default, makes a column of each status the tasks use, in the order they first appear. A task whose status has no column is shown in the first column. Never null.

Adding, removing and replacing columns is seen at once. A BoardColumn does not say when its own properties change; replace it, or call Reschedule.

CriticalBrush

public Brush CriticalBrush

The stripe along a critical card's leading edge. A red-orange by default.

Holidays

public IList<DateTime> Holidays

Dates that are not worked, beside the days WorkingWeek leaves out. Never null; an observable collection is watched.

IsReadOnly

public bool IsReadOnly

Stops the reader moving cards; they can still be selected, activated and read. The application can still move them with MoveCard. False by default.

LaneBy

public BoardLaneBy LaneBy

What the rows of the board are: none, the assignee, the category, or the phase. None by default.

OverLimitBrush

public Brush OverLimitBrush

A column's count when it is over its limit, and a place a carried card would be refused. A deep orange by default.

ProgressBrush

public Brush ProgressBrush

The progress bar along the bottom of a card. A calm blue by default.

ProjectStart

public DateTime? ProjectStart

The first day work can happen. Null starts the plan at its earliest planned date, or today when no task has one.

Schedule

public ProjectSchedule Schedule

The plan as last scheduled: every task's dates, its float, and the critical path. Scheduled again first when anything has changed.

SelectedTask

public ProjectTask SelectedTask

The selected task, which is also the card the arrow keys move from; null when none is. A task that is not a card - a summary, or one not in Tasks - selects nothing.

SelectionBrush

public Brush SelectionBrush

The outline of the selected and the carried card, and the mark showing where a carried card would land. Null, the default, uses the system's highlight colour.

ShowCriticalPath

public bool ShowCriticalPath

Marks each card on the critical path with a stripe in CriticalBrush. True by default.

StrictLimits

public bool StrictLimits

Refuses a card to a column that is already at its limit. False by default, when a column may go over its limit and says so in its heading.

Tasks

public IList<ProjectTask> Tasks

The tasks: a flat list in outline order, each naming its parent. Summary tasks are not cards. Never null; setting null gives the board an empty list of its own.

An ObservableCollection{T} or a BindingList is watched, and so is every task in it. A plain list is read when it is assigned; call Reschedule after changing one.

Today

public DateTime? Today

The date the charts treat as today; null for the computer's own date. The Gantt chart draws its today line here. A board has no timeline and draws nothing for it; the property is here so that one set of settings can be given to all three charts alike.

VisualChildrenCount

protected override int VisualChildrenCount

The children are the two scroll bars; everything else is drawn.

WorkingWeek

public WorkingWeek WorkingWeek

The days of the week that are worked. Monday to Friday by default.

Methods

ArrangeOverride

protected override Size ArrangeOverride(Size arrangeBounds)

Places the scroll bars, which appear only when the board is larger than the view.

arrangeBounds
The size the board has been given.

Returns. The size used: all of it.

GetEnumerator

protected override IEnumerator LogicalChildren

The scroll bars, as logical children, so that they inherit the board's resources and font.

GetVisualChild

protected override Visual GetVisualChild(int index)

Returns a scroll bar.

index
0 for the vertical bar, 1 for the horizontal.

Returns. The scroll bar.

MeasureOverride

protected override Size MeasureOverride(Size constraint)

Asks for the whole board's size, or the space available when that is less.

constraint
The space available.

Returns. The size wanted.

MoveCard

public bool MoveCard(ProjectTask task, string status, string lane, int index)

Moves a task's card, exactly as the reader would: CardMoving is raised first and can cancel it, and StrictLimits applies. The move is reported with Application as its source.

task
The task whose card moves.
status
The column to move it to: a Status on the board.
lane
The lane: the value of the LaneBy field, empty for the lane of tasks without one, or null to keep its lane. Ignored when LaneBy is None.
index
Its position in the cell, from 0; a negative or too large number puts it last.

Returns. True when the card moved; false when it was cancelled, refused, or is not on the board.

OnCreateAutomationPeer

protected override AutomationPeer OnCreateAutomationPeer()

Gives UI Automation the board as a list of headings and cards.

Returns. The board's automation peer.

OnDpiChanged

protected override void OnDpiChanged(DpiScale oldDpi, DpiScale newDpi)

Redraws for a new screen density, so text is measured for the pixels it lands on.

oldDpi
The density before.
newDpi
The density now.

OnGotKeyboardFocus

protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)

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

e
The event data.

OnKeyDown

protected override void OnKeyDown(KeyEventArgs e)

The arrows, Home and End move between cards; Space picks the current card up; Enter activates it; the page keys scroll. While a card is carried the arrows carry it, Space or Enter drops it and Escape puts it back.

e
The key.

OnLostKeyboardFocus

protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)

A card carried from the keyboard is put back when the board loses the keyboard: the reader can no longer see or steer where it would go.

e
The event data.

OnLostMouseCapture

protected override void OnLostMouseCapture(MouseEventArgs e)

A drag ends without a move if something else takes the mouse - a window coming to the front, or the application capturing it.

e
The event data.

OnMouseLeave

protected override void OnMouseLeave(MouseEventArgs e)

Hides the tooltip when the pointer leaves the board.

e
The event data.

OnMouseLeftButtonDown

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)

Selects the card under the pointer; a double-click activates it, and a drag can follow.

e
The press.

OnMouseLeftButtonUp

protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)

Drops a dragged card where the pointer is; a press that never became a drag was just a click.

e
The release.

OnMouseMove

protected override void OnMouseMove(MouseEventArgs e)

Starts a drag once the pointer has moved far enough, then carries the card; otherwise follows the pointer for the tooltip.

e
The move.

OnMouseWheel

protected override void OnMouseWheel(MouseWheelEventArgs e)

Scrolls down and up; with Shift, across.

e
The wheel turn.

OnPropertyChanged

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)

Drops what was resolved from the inherited text and colour settings - the font, the foreground, the background, the language, the reading direction and the text formatting mode - when one changes.

e
The property that changed.

OnQueryCursor

protected override void OnQueryCursor(QueryCursorEventArgs e)

A hand over a card that can be moved and while one is dragged; "not allowed" over a place that refuses it.

e
The event data.

OnRender

protected override void OnRender(DrawingContext drawingContext)

Draws the board: headings over the scrolling body, then a dragged card's copy over both.

drawingContext
Where to draw.

Reschedule

public void Reschedule()

Schedules the plan again now and redraws. Needed only after changing a plain list that does not say when it changes, a task in one, or a BoardColumn's properties.

ScrollToTask

public void ScrollToTask(ProjectTask task)

Scrolls the board, as little as it needs to, so that a task's card is in view. Nothing happens for a task that is not a card.

task
The task to show.

Events

CardMoved

public event EventHandler<TaskEventArgs> CardMoved

Raised after a card has moved and its task has been changed.

CardMoving

public event EventHandler<CardMovingEventArgs> CardMoving

Raised before a card moves, by the pointer, the keyboard or MoveCard. Cancel it to keep the card where it is; nothing has changed yet.

ScheduleChanged

public event EventHandler ScheduleChanged

Raised after the plan has been scheduled again because something changed: a task, a link, a collection, or one of the scheduling settings.

SelectedTaskChanged

public event EventHandler SelectedTaskChanged

Raised when SelectedTask changes, by the reader or by the application.

TaskActivated

public event EventHandler<TaskEventArgs> TaskActivated

Raised when the reader double-clicks a card, or presses Enter on the current one.

Fields

BadgeBrushProperty

public static readonly DependencyProperty BadgeBrushProperty

Identifies the BadgeBrush dependency property.

CardBackgroundBrushProperty

public static readonly DependencyProperty CardBackgroundBrushProperty

Identifies the CardBackgroundBrush dependency property.

CardBorderBrushProperty

public static readonly DependencyProperty CardBorderBrushProperty

Identifies the CardBorderBrush dependency property.

CardHeightProperty

public static readonly DependencyProperty CardHeightProperty

Identifies the CardHeight dependency property.

ColumnBackgroundBrushProperty

public static readonly DependencyProperty ColumnBackgroundBrushProperty

Identifies the ColumnBackgroundBrush dependency property.

ColumnWidthProperty

public static readonly DependencyProperty ColumnWidthProperty

Identifies the ColumnWidth dependency property.

ColumnsProperty

public static readonly DependencyProperty ColumnsProperty

Identifies the Columns dependency property.

CriticalBrushProperty

public static readonly DependencyProperty CriticalBrushProperty

Identifies the CriticalBrush dependency property.

HolidaysProperty

public static readonly DependencyProperty HolidaysProperty

Identifies the Holidays dependency property.

IsReadOnlyProperty

public static readonly DependencyProperty IsReadOnlyProperty

Identifies the IsReadOnly dependency property.

LaneByProperty

public static readonly DependencyProperty LaneByProperty

Identifies the LaneBy dependency property.

LinksProperty

public static readonly DependencyProperty LinksProperty

Identifies the Links dependency property.

OverLimitBrushProperty

public static readonly DependencyProperty OverLimitBrushProperty

Identifies the OverLimitBrush dependency property.

ProgressBrushProperty

public static readonly DependencyProperty ProgressBrushProperty

Identifies the ProgressBrush dependency property.

ProjectStartProperty

public static readonly DependencyProperty ProjectStartProperty

Identifies the ProjectStart dependency property.

SelectedTaskProperty

public static readonly DependencyProperty SelectedTaskProperty

Identifies the SelectedTask dependency property.

SelectionBrushProperty

public static readonly DependencyProperty SelectionBrushProperty

Identifies the SelectionBrush dependency property.

ShowCriticalPathProperty

public static readonly DependencyProperty ShowCriticalPathProperty

Identifies the ShowCriticalPath dependency property.

StrictLimitsProperty

public static readonly DependencyProperty StrictLimitsProperty

Identifies the StrictLimits dependency property.

TasksProperty

public static readonly DependencyProperty TasksProperty

Identifies the Tasks dependency property.

TodayProperty

public static readonly DependencyProperty TodayProperty

Identifies the Today dependency property.

WorkingWeekProperty

public static readonly DependencyProperty WorkingWeekProperty

Identifies the WorkingWeek dependency property.