Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149927 | Dec 14,2019 09:58 PM UTC | Dec 16,2019 09:53 AM UTC | WPF | 1 |
![]() |
Tags: GanttControl |
private void Gantt_OnLoaded(object sender, RoutedEventArgs e)
{
ObservableCollection<double> RiskPercent = new ObservableCollection<double>();
RiskPercent.Add(10);
RiskPercent.Add(20);
RiskPercent.Add(30);
RiskPercent.Add(40);
RiskPercent.Add(50);
RiskPercent.Add(60);
RiskPercent.Add(70);
RiskPercent.Add(80);
RiskPercent.Add(90);
// Creating a new custom column with combo box
GridTreeColumn riskColumn = new GridTreeColumn
{
MappingName = "RiskPercentage",
HeaderText = "Risk",
Width = 120,
StyleInfo = new GridStyleInfo
{
CellType = "ComboBox",
ItemsSource = RiskPercent,
HorizontalAlignment =
HorizontalAlignment
.Center,
VerticalAlignment =
VerticalAlignment
.Center
}
};
this.Gantt.GanttGrid.InternalGrid.DropDownSelectionChanged += InternalGrid_DropDownSelectionChanged;
this.Gantt.GanttGrid.Columns.Insert(2, riskColumn);
}
private void InternalGrid_DropDownSelectionChanged(object sender, GridCellComboValueChangedEventArgs args)
{
GridTreeNode node = this.Gantt.GanttGrid.InternalGrid.GetNodeAtRowIndex(args.CellRowColumnIndex.RowIndex);
int risk;
if (node != null && node.Item != null)
{
if (int.TryParse(args.SelectedItem as string, out risk))
{
(node.Item as Task).RiskPercentage = risk;
}
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.