Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149573 | Dec 1,2019 02:36 PM UTC | Dec 3,2019 08:57 AM UTC | WPF | 3 |
![]() |
Tags: GanttControl |
public MainWindow()
{
InitializeComponent();
Gantt.CustomScheduleSource = GetCustomScheduleSource();
}
public IList<GanttScheduleRowInfo> GetCustomScheduleSource()
{
return new List<GanttScheduleRowInfo>
{
new GanttScheduleRowInfo
{
TimeUnit = TimeUnit.Days,
PixelsPerUnit = 45,
CellTextFormat = "dd"
},
new GanttScheduleRowInfo
{
TimeUnit = TimeUnit.Hours,
PixelsPerUnit = 30,
CellTextFormat = "hh"
}
};
}
|
<sync:GanttControl x:Name="Gantt"
ItemsSource="{Binding TaskCollection}"
ResourceCollection="{Binding ResourceCollection}"
VisualStyle="Metro" ScheduleType="CustomDateTime" >
<sync:GanttControl.TaskAttributeMapping>
<sync:TaskAttributeMapping TaskIdMapping="TaskId"
TaskNameMapping="TaskName"
StartDateMapping="StartDate"
ChildMapping="Child"
FinishDateMapping="FinishDate"
DurationMapping="Duration"
MileStoneMapping="IsMileStone"
ProgressMapping="Progress"
PredecessorMapping="Predecessor"
ResourceInfoMapping="Resources"/>
</sync:GanttControl.TaskAttributeMapping>
</sync:GanttControl> |
private void Gantt_Loaded(object sender, RoutedEventArgs e)
{
for(int i=0;i< Gantt.GanttGrid.InternalGrid.Columns.Count;i++)
{
var column = Gantt.GanttGrid.InternalGrid.Columns[i];
if (column.HeaderText == "Duration")
{
column.StyleInfo.TimeSpanEdit.Format = "hh:mm:ss";
}
else if(column.HeaderText == "Start" || column.HeaderText == "Finish")
{
column.StyleInfo.DateTimeEdit.DateTimePattern = Syncfusion.Windows.Shared.DateTimePattern.CustomPattern;
column.StyleInfo.DateTimeEdit.CustomPattern = "MM / dd / yyyy hh:mm:ss";
}
}
Gantt.GanttGrid.Model.ColumnWidths[4] = 180;
Gantt.GanttGrid.Model.ColumnWidths[3] = 180;
Gantt.GanttGrid.InternalGrid.InvalidateCells();
}
} |
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.