Note: Please take a look at the "Appearance\GanttControlTableCustomization" sample where these features are illustrated.
Accessing GanttTable's Columns
The earliest you can access the GanttTable's Columns is in it's TemplateApplied event as shown:
// In the Form's constructor:
this.ganttControl.TemplateApplied += new EventHandler(
delegate(object sender, EventArgs e)
{
this.ganttControl.GanttTable.TemplateApplied += new EventHandler(GanttTable_TemplateApplied);
}
);
void GanttTable_TemplateApplied(object sender, EventArgs e)
{
// Access the GanttTable.Columns property.
}
Freezing Columns / Frozen Columns
// To Freeze columns: (In GanttTable.TemplateApplied event)
this.ganttControl.GanttTable.FrozenColumnCount = 2;
Adding Columns
You can add columns to bind to custom properties in your data source.
In your XAML resource:
<gantt:GanttTableTemplateColumn x:Key="descColumnTemplate" Header="Description" >
<gantt:GanttTableTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Activity.DataSource.Description, Converter={StaticResource dtToTextConverter}}" VerticalAlignment="Center"
Margin="2,0,0,0"></TextBlock>
</DataTemplate>
</gantt:GanttTableTemplateColumn.CellTemplate>
<gantt:GanttTableTemplateColumn.CellEditingTemplate>
<DataTemplate>
<!-- Use any kind of editors here, can be a DatePicker, ComboBox, etc. -->
<TextBox Text="{Binding Activity.DataSource.Description, Mode=TwoWay}" VerticalAlignment="Center"></TextBox>
</DataTemplate>
</gantt:GanttTableTemplateColumn.CellEditingTemplate>
</gantt:GanttTableTemplateColumn>
In your code behind, in GanttTable's TemplateApplied event:
// To Add a new column for the Description field in your bound data:
this.ganttControl.GanttTable.Columns.Insert(3, this.LayoutRoot.Resources["descColumnTemplate"] as DataGridTemplateColumn);
Deleting Columns
In your code behind, in GanttTable's TemplateApplied event:
// To deleta an existing column (Resources column in this case):
this.ganttControl.GanttTable.Columns.RemoveAt(6);
Changing Column Order
In your code behind, in GanttTable's TemplateApplied event:
// To move a column's order:
this.ganttControl.GanttTable.Columns[4].DisplayIndex--;
Hiding Columns
In your code behind, in GanttTable's TemplateApplied event:
// To hide a column:
this.ganttControl.GanttTable.Columns[0].Visibility = Visibility.Collapsed;
� RadiantQ 2009 - 2019. All Rights Reserved.