Please use the following code snippet:
public partial class Form1 : Form
{
public class VM
{
public string Text
{
get; set;
}
public DateTime Start
{
get; set;
}
public DateTime End
{
get; set;
}
}
public Form1()
{
InitializeComponent();
var ViewModel = new VM[]
{
new VM()
{
Text = "CrashTest",
Start = new DateTime(2021, 11, 3, 10, 0, 0),
End = new DateTime( 2021, 11, 3, 23, 0, 0 ) //crash
//End = new DateTime( 2021, 11, 3, 22, 0, 0 ) //No crash
},
};
radGanttView1.GanttViewElement.GraphicalViewElement.OnePixelTime = new TimeSpan( 0, 1, 0 );
radGanttView1.GanttViewElement.GraphicalViewElement.TimelineStart = ViewModel.Min( T => T.Start );
radGanttView1.GanttViewElement.GraphicalViewElement.TimelineEnd = ViewModel.Max( T => T.End );
radGanttView1.GanttViewElement.GraphicalViewElement.TimelineRange = TimeRange.Day;
radGanttView1.GanttViewElement.ChildMember = "Text";
radGanttView1.GanttViewElement.TitleMember = "Text";
radGanttView1.GanttViewElement.StartMember = "Start";
radGanttView1.GanttViewElement.EndMember = "End";
radGanttView1.DataSource = ViewModel;
}
}
Currently, the possible solution that I can suggest is to increase the view's end with 1 hour:
radGanttView1.GanttViewElement.GraphicalViewElement.TimelineEnd = ViewModel.Max( T => T.End.AddHours(1));