Version

Setting and Retrieving the Active Element

Topic Overview

Purpose

This topic describes the properties and events used to set or retrieve the currently active cell, column or row in the xamGantt™ control.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic describes how to add the xamGantt control to a page.

Properties Configuration Summary

Properties configuration summary chart

The following table lists the configurable aspects and corresponding properties for setting and retrieving the active element in the xamGantt control.

Configurable aspect Details Property

Getting or setting the currently active cell

Identify or modify the currently active cell via the xamGantt ActiveCell property.

The property exposes information about the active cell Row and Column.

Getting or setting the currently active column

Identify or modify the currently active column via the xamGantt ActiveColumn property.

The property exposes information about the active column Key.

Getting or setting the currently active row

Identify or modify the currently active row via the xamGantt ActiveRow property.

The property exposes information about the active Task.

Events Summary

Events summary chart

The following table identifies the event to set and retrieve the active element in the xamGantt control.

In order to: Use this event:

Handle the change of the xamGantt active cell

Code Example: Identifying Active Task

Description

The code snippet demonstrates how to use the xamGantt ActiveCellChanged event to identify the currently active task and its name. Every time you select or click in a xamGantt cell, you automatically trigger the ActiveCellChanged event.

Code

In XAML:

<ig:XamGantt x:Name="gantt"
             Project="{Binding Project}"
             ActiveCellChanged="gantt_ActiveCellChanged"/>

In C#:

private void gantt_ActiveCellChanged(object sender, System.EventArgs e)
{
    if (this.gantt.ActiveRow.HasValue)
    {
        string msg = string.Format("The current active task is {0}.",this.gantt.ActiveRow.Value.Task.TaskName);
        System.Diagnostics.Debug.WriteLine(msg);
    }
}

In Visual Basic:

Private Sub gantt_ActiveCellChanged(sender As System.Object, e As System.EventArgs)
    If Me.gantt.ActiveRow.HasValue Then
        Dim msg As String = String.Format("The current active task is {0}.", Me.gantt.ActiveRow.Value.Task.TaskName)
        System.Diagnostics.Debug.WriteLine(msg)
    End If
End Sub

Related Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic describes the events and their arguments used to retrieve information about the currently selected cells, columns or rows in the xamGantt control.

This topic describes some of the available events triggered by common user interactions in the xamGantt control.