<ig:XamGantt x:Name="gantt"
Project="{Binding Project}"
SelectedRowsChanged="gantt_SelectedRowsChanged"/>
This topic describes the events and their arguments used to retrieve information about the currently selected cells, columns or rows in the xamGantt™ control.
The following topics are prerequisites to understanding this topic:
This topic contains the following sections:
The following table lists the events for retrieving the selected elements in the xamGantt control.
The code snippet demonstrates how to use xamGantt SelectedRowsChanged
event to identify the currently selected tasks and their names.
Multiple rows can be selected; however, selecting a xamGantt row triggers the SelectedRowsChanged
event.
In XAML:
<ig:XamGantt x:Name="gantt"
Project="{Binding Project}"
SelectedRowsChanged="gantt_SelectedRowsChanged"/>
In C#:
private void gantt_SelectedRowsChanged(object sender, GanttGridSelectionChangedEventArgs<GanttGridRow> e)
{
// Get the newly selected rows
var selectedRows = e.NewSelectedItems;
foreach (GanttGridRow row in selectedRows)
{
string msg = string.Format("The {0} task is selected.", row.Task.TaskName);
System.Diagnostics.Debug.WriteLine(msg);
}
System.Diagnostics.Debug.WriteLine("Selected rows count is " + selectedRows.Count);
}
In Visual Basic:
Private Sub gantt_SelectedRowsChanged(sender As Object, e As GanttGridSelectionChangedEventArgs(Of GanttGridRow))
' Get the newly selected rows
Dim selectedRows = e.NewSelectedItems
For Each row As GanttGridRow In selectedRows
Dim msg As String = String.Format("The {0} task is selected.", row.Task.TaskName)
System.Diagnostics.Debug.WriteLine(msg)
Next
System.Diagnostics.Debug.WriteLine("Selected rows count is " & Convert.ToString(selectedRows.Count))
End Sub
The following topics provide additional information related to this topic.