Completed
Last Updated: 11 Jan 2016 10:48 by ADMIN
How to reproduce: refer to the attached project

Workaround: reset the data source
private void Button1_Click(object sender, EventArgs e)
{
	this.RadGanttView1.DataSource = null;

	//TODO: This line of code loads data into the 'WeddingPlannerDataSet.Tasks' table. You can move, or remove it, as needed.
	this.TasksTableAdapter.Fill(this.WeddingPlannerDataSet.Tasks);
	//TODO: This line of code loads data into the 'WeddingPlannerDataSet.Links' table. You can move, or remove it, as needed.
	this.LinksTableAdapter.Fill(this.WeddingPlannerDataSet.Links);

	this.RadGanttView1.GanttViewElement.DataSource = this.WeddingPlannerDataSet 
}
Completed
Last Updated: 29 Apr 2016 07:31 by ADMIN
ADMIN
Created by: Hristo
Comments: 0
Category: GanttView
Type: Bug Report
0
How to reproduce:
1. Subscribe to radGanttView DoubleClick event.
2. Double click at any point on ragGanttView

Woraround:
1. Create a custom RadGanttView and override the OnMouseDoubleClick method
public class MyRadGanttView : RadGanttView
{

    protected override void OnMouseDoubleClick(MouseEventArgs e)
    {
        if (this.GanttViewElement.ProcessDoubleClick(e))
        {
            return;
        }

        MouseEventHandler item = (MouseEventHandler)base.Events[typeof(Control).GetField("EventMouseDoubleClick", BindingFlags.NonPublic | BindingFlags.Static).GetValue(this)];
        if (item != null)
        {
            item(this, e);
        }
    }
}

Completed
Last Updated: 18 May 2016 09:29 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 2
Category: GanttView
Type: Bug Report
0
To reproduce: use the following code snippet and try to drag an item or click over a task item:

private ViewModel viewModel;

public Form1()
{
    InitializeComponent();
    viewModel = new ViewModel();
    viewModel.Init();
    viewModel.DateChanged += ViewModelOnDateChanged;

    this.radGanttView1.Ratio = 0.3F;
    this.radGanttView1.SplitterWidth = 7;
    this.radGanttView1.TitleMember = "Name";
    this.radGanttView1.ChildMember = "Id";
    this.radGanttView1.EndMember = "End";
    this.radGanttView1.ParentMember = "ParentId";
    this.radGanttView1.ProgressMember = "Progress";
    this.radGanttView1.StartMember = "Start";
    this.radGanttView1.TaskDataMember = "TimingRows";
    this.radGanttView1.LinkDataMember = "LinkRows";
    this.radGanttView1.LinkStartMember = "StartId";
    this.radGanttView1.LinkEndMember = "EndId";
    this.radGanttView1.LinkTypeMember = "LinkType";

    this.radGanttView1.DataSource = viewModel;

    this.radGanttView1.Click += radGanttView1_Click;
}

private void radGanttView1_Click(object sender, EventArgs e)
{ 
    this.radGanttView1.DataSource = null;
    this.radGanttView1.DataSource = viewModel;
}

private void radGanttView1_MouseEnter(object sender, EventArgs e)
{
    this.radGanttView1.DataSource = null;
    this.radGanttView1.DataSource = viewModel;
}

private void ViewModelOnDateChanged(object sender, EventArgs eventArgs)
{
    BeginInvoke(new Action(() =>
    {
        this.radGanttView1.DataSource = null;
        this.radGanttView1.DataSource = viewModel;
    }));
}

public class ViewModel
{
    public event EventHandler DateChanged;

    public BindingList<TimingRow> TimingRows { get; set; }

    public BindingList<LinkRow> LinkRows { get; set; }

    public ViewModel()
    {
        TimingRows = new BindingList<TimingRow>();
        LinkRows = new BindingList<LinkRow>();
    }

    public void Init()
    {
        AddRow(1, 0, "group", 3, 12);
        AddRow(2, 1, "Test1", 3, 4);
        AddRow(3, 1, "Test2", 7, 8);
        AddLink(2, 3, 1);
    }

    private void AddLink(int p1, int p2, int p3)
    {
        var link = new LinkRow(p1, p2, p3);
        LinkRows.Add(link);
    }

    private void AddRow(int id, int parentId, string name, int addDays, int howLong)
    {
        var row = new TimingRow
        {
            Start = DateTime.Today.AddDays(addDays),
            End = DateTime.Today.AddDays(addDays + howLong),
            Id = id,
            ParentId = parentId,
            Name = name
        };
        row.DateChanged += RowOnDateChanged;
        TimingRows.Add(row);
    }

    private void RowOnDateChanged(object sender, EventArgs eventArgs)
    {
        if (DateChanged != null)
            DateChanged(this, EventArgs.Empty);
    }
}

public class TimingRow
{
    public event EventHandler DateChanged;

    private DateTime start;

    public string Name { get; set; }

    public int Id { get; set; }

    public int ParentId { get; set; }

    public decimal Progress
    {
        get
        {
            return 0;
        }
    }

    public virtual DateTime Start
    {
        get
        {
            return start;
        }
        set
        {
            if (start == value)
                return;
            if (DateChanged != null)
                DateChanged(this, EventArgs.Empty);
            start = value;
        }
    }

    public virtual DateTime End { get; set; }
}

public class LinkRow
{
    public int StartId { get; set; }

    public int EndId { get; set; }

    public int LinkType { get; set; }

    public LinkRow(int startId, int endId, int linkType)
    {
        this.StartId = startId;
        this.EndId = endId;
        this.LinkType = linkType;
    }
}
---------------------------------------------------------------------------------
WORKAROUND:

private void radGanttView1_CreateDataItem(object sender, Telerik.WinControls.UI.CreateGanttDataItemEventArgs e)
{
    e.Item = new CustomGanttViewDataItem();
}

public class CustomGanttViewDataItem : GanttViewDataItem
{
    protected override void OnNotifyPropertyChanged(PropertyChangedEventArgs e)
    {
        if (this.GanttViewElement != null)
        {
            base.OnNotifyPropertyChanged(e);
        }
    }
}

public class CustomGanttView : RadGanttView
{
    public override string ThemeClassName
    {
        get
        {
            return typeof(RadGanttView).FullName;
        }
    }

    protected override RadGanttViewElement CreateGanttViewElement()
    {
        return new CustomRadGanttViewElement();
    }
}

public class CustomRadGanttViewElement : RadGanttViewElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(RadGanttViewElement);
        }
    }

    protected override GanttViewGraphicalViewElement CreateGraphicalViewElement(RadGanttViewElement ganttView)
    {
        return new CustomGanttViewGraphicalViewElement(ganttView);
    }
}

public class CustomGanttViewGraphicalViewElement : GanttViewGraphicalViewElement
{
    protected override Type ThemeEffectiveType
    {
        get
        {
            return typeof(GanttViewGraphicalViewElement);
        }
    }

    public CustomGanttViewGraphicalViewElement(RadGanttViewElement ganttView) : base(ganttView)
    {
    }

    protected override IVirtualizedElementProvider<GanttViewDataItem> CreateElementProvider()
    {
        return new CustomGanttViewVirtualizedElementProvider(this);
    }
}

public class CustomGanttViewVirtualizedElementProvider : GanttViewVirtualizedElementProvider
{
    GanttViewBaseViewElement owner;

    public CustomGanttViewVirtualizedElementProvider(GanttViewBaseViewElement owner) : base(owner)
    {
        this.owner = owner;
    }

    public override IVirtualizedElement<GanttViewDataItem> CreateElement(GanttViewDataItem data, object context)
    {
        GanttViewBaseItemElement element = this.OnItemElementCreating(data);

        if (element != null)
        {
            return element;
        }

        if (owner is GanttViewTextViewElement)
        {
            return new GanttViewTextItemElement(owner as GanttViewTextViewElement);
        }
        else
        {
            if (data.Items.Count > 0)
            {
                return new GanttViewSummaryItemElement(this.owner as GanttViewGraphicalViewElement);
            }
            else if (data.Start == data.End)
            {
                return new GanttViewMilestoneItemElement(this.owner as GanttViewGraphicalViewElement);
            }

            return new CustomGanttViewTaskItemElement(this.owner as GanttViewGraphicalViewElement);
        }
    }
}

public class CustomGanttViewTaskItemElement : GanttViewTaskItemElement
{
    public CustomGanttViewTaskItemElement(GanttViewGraphicalViewElement owner) : base(owner)
    {
    }

    public override void Synchronize()
    {
        if (this.Data.GanttViewElement != null)
        {
            base.Synchronize();
        }
    }
}
Completed
Last Updated: 15 Aug 2017 10:20 by ADMIN
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GanttView
Type: Bug Report
0
To reproduce: please refer to the attached sample project and follow the steps in the gif file.

Workaround: 

private void radGanttView1_ContextMenuOpening(object sender, Telerik.WinControls.UI.GanttViewContextMenuOpeningEventArgs e)
{
    foreach (RadMenuItem item in e.Menu.Items)
    {
        if (item.Text == "&Delete")
        {
            item.MouseDown -= item_MouseDown;
            item.MouseDown += item_MouseDown;
        }
    }
}

private void item_MouseDown(object sender, MouseEventArgs e)
{
    this.radGanttView1.GanttViewElement.BeginUpdate();

    if (this.radGanttView1.SelectedItem.Parent == null)
    {
        while (this.radGanttView1.SelectedItem.Items.Count > 0)
        {
            this.radGanttView1.SelectedItem.Items.RemoveAt(0);
        }
    }
    this.radGanttView1.GanttViewElement.EndUpdate();
}
Completed
Last Updated: 15 Mar 2018 12:26 by Dimitar
How to reproduce:
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        new RadControlSpyForm().Show();

        this.radGanttView.GanttViewElement.GraphicalViewElement.OnePixelTime = new TimeSpan(6, 0, 0);

        this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineRange = TimeRange.YearHalves;

        this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineStart = new DateTime(2016, 12, 25);
        this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineEnd = new DateTime(2017, 1, 27);


        this.AddTasks();
    }

    private void AddTasks()
    {
        //Setup data items
        GanttViewDataItem item1 = new GanttViewDataItem();
        item1.Start = new DateTime(2017, 1, 1);
        item1.End = new DateTime(2017, 1, 20);
        item1.Progress = 30m;
        item1.Title = "Summary task.1. title";

        GanttViewDataItem subItem11 = new GanttViewDataItem();
        subItem11.Start = new DateTime(2017, 1, 1);
        subItem11.End = new DateTime(2017, 1, 20);
        subItem11.Progress = 10m;
        subItem11.Title = "Sub-task.1.1 title";

        GanttViewDataItem subItem12 = new GanttViewDataItem();
        subItem12.Start = new DateTime(2017, 1, 1);
        subItem12.End = new DateTime(2017, 1, 20);
        subItem12.Progress = 20m;
        subItem12.Title = "Sub-task.1.2 title";

        GanttViewDataItem subItem13 = new GanttViewDataItem();
        subItem13.Start = new DateTime(2017, 1, 5);
        subItem13.End = new DateTime(2017, 1, 20);
        subItem13.Progress = 20m;
        subItem13.Title = "Sub-task.1.3 title";

        //Add subitems
        item1.Items.Add(subItem11);
        item1.Items.Add(subItem12);
        item1.Items.Add(subItem13);

        this.radGanttView.Items.Add(item1);

        GanttViewTextViewColumn titleColumn = new GanttViewTextViewColumn("Title");
        GanttViewTextViewColumn startColumn = new GanttViewTextViewColumn("Start");
        GanttViewTextViewColumn endColumn = new GanttViewTextViewColumn("End");

        this.radGanttView.GanttViewElement.Columns.Add(titleColumn);
        this.radGanttView.GanttViewElement.Columns.Add(startColumn);
        this.radGanttView.GanttViewElement.Columns.Add(endColumn);
    }
}

Workaround: 

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        new RadControlSpyForm().Show();

        this.radGanttView.GanttViewElement.GraphicalViewElement.OnePixelTime = new TimeSpan(6, 0, 0);

        this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineRange = TimeRange.YearHalves;
        this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineBehavior = new CustomTimelineBehavior();

        this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineStart = new DateTime(2016, 12, 25);
        this.radGanttView.GanttViewElement.GraphicalViewElement.TimelineEnd = new DateTime(2017, 1, 27);


        this.AddTasks();
    }

    private void AddTasks()
    {
        //Setup data items
        GanttViewDataItem item1 = new GanttViewDataItem();
        item1.Start = new DateTime(2017, 1, 1);
        item1.End = new DateTime(2017, 1, 20);
        item1.Progress = 30m;
        item1.Title = "Summary task.1. title";

        GanttViewDataItem subItem11 = new GanttViewDataItem();
        subItem11.Start = new DateTime(2017, 1, 1);
        subItem11.End = new DateTime(2017, 1, 20);
        subItem11.Progress = 10m;
        subItem11.Title = "Sub-task.1.1 title";

        GanttViewDataItem subItem12 = new GanttViewDataItem();
        subItem12.Start = new DateTime(2017, 1, 1);
        subItem12.End = new DateTime(2017, 1, 20);
        subItem12.Progress = 20m;
        subItem12.Title = "Sub-task.1.2 title";

        GanttViewDataItem subItem13 = new GanttViewDataItem();
        subItem13.Start = new DateTime(2017, 1, 5);
        subItem13.End = new DateTime(2017, 1, 20);
        subItem13.Progress = 20m;
        subItem13.Title = "Sub-task.1.3 title";

        //Add subitems
        item1.Items.Add(subItem11);
        item1.Items.Add(subItem12);
        item1.Items.Add(subItem13);

        this.radGanttView.Items.Add(item1);

        GanttViewTextViewColumn titleColumn = new GanttViewTextViewColumn("Title");
        GanttViewTextViewColumn startColumn = new GanttViewTextViewColumn("Start");
        GanttViewTextViewColumn endColumn = new GanttViewTextViewColumn("End");

        this.radGanttView.GanttViewElement.Columns.Add(titleColumn);
        this.radGanttView.GanttViewElement.Columns.Add(startColumn);
        this.radGanttView.GanttViewElement.Columns.Add(endColumn);
    }
}

public class CustomTimelineBehavior : BaseGanttViewTimelineBehavior
{
    public override DateTime AdjustedTimelineStart
    {
        get
        {
            if (this.GraphicalViewElement.TimelineRange == TimeRange.YearHalves)
            {
                DateTime result = this.GraphicalViewElement.TimelineStart;
                int halfYearDay = DateTime.IsLeapYear(result.Year) ? 366 / 2 : 365 / 2;
                if (result.DayOfYear < halfYearDay)
                {
                    return new DateTime(result.Year, 1, 1);
                }
                else
                {
                    return new DateTime(result.Year, 1, 1).AddDays(halfYearDay);
                }
            }

            return base.AdjustedTimelineStart;
        }
    }

    public override DateTime AdjustedTimelineEnd
    {
        get
        {
            if (this.GraphicalViewElement.TimelineRange == TimeRange.YearHalves)
            {
                DateTime result = this.GraphicalViewElement.TimelineEnd;
                int halfYearDay = DateTime.IsLeapYear(result.Year) ? 366 / 2 : 365 / 2;
                if (result.DayOfYear < halfYearDay)
                {
                    return new DateTime(result.Year, 1, 1).AddDays(halfYearDay + 1);
                }
                else
                {
                    return new DateTime(result.Year, 1, 1).AddYears(1);
                }
            }

            return base.AdjustedTimelineEnd;
        }
    }
}
Completed
Last Updated: 30 Apr 2018 06:58 by Dimitar
The spin editor has a default minimum and maximum (0,100)

Workaround:
private void GanttViewElement_EditorInitialized(object sender, GanttViewItemEditorInitializedEventArgs e)
{
    var editor = e.Editor as BaseSpinEditor;
    if (editor != null)
    {
        editor.MaxValue = int.MaxValue;
        var value = e.Item[radGanttView1.CurrentColumn];
        editor.Value = value;
    }
}
Completed
Last Updated: 30 Apr 2018 11:16 by Dimitar
ADMIN
Created by: Dess | Tech Support Engineer, Principal
Comments: 0
Category: GanttView
Type: Bug Report
0
Even though you can't  modify the tasks you can see the link handles which are usually used for linking different tasks. They shouldn't be displayed when the RadGanttView is in read-only mode.

Workaround: handle the GraphicalViewItemFormatting event and manually hide the link handles: 

        private void radGanttView1_GraphicalViewItemFormatting(object sender, GanttViewGraphicalViewItemFormattingEventArgs e)
        {
            GanttGraphicalViewBaseItemElement itemElement = e.ItemElement as GanttGraphicalViewBaseItemElement;
            if (itemElement != null)
            {
                Console.WriteLine(itemElement.LeftLinkHandleElement.Visibility);
                itemElement.LeftLinkHandleElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
                itemElement.LeftLinkHandleElement.PropertyChanged -= LeftLinkHandleElement_PropertyChanged;
                itemElement.LeftLinkHandleElement.PropertyChanged += LeftLinkHandleElement_PropertyChanged;
                itemElement.RightLinkHandleElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
                itemElement.RightLinkHandleElement.PropertyChanged -= LeftLinkHandleElement_PropertyChanged;
                itemElement.RightLinkHandleElement.PropertyChanged += LeftLinkHandleElement_PropertyChanged;
            }
        }

        private void LeftLinkHandleElement_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            GanttViewTaskLinkHandleElement linkHanle = sender as GanttViewTaskLinkHandleElement;
            if (e.PropertyName == "Visibility" && linkHanle.Visibility == Telerik.WinControls.ElementVisibility.Visible)
            {
                linkHanle.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
            }
        }
Completed
Last Updated: 01 Jul 2019 14:52 by ADMIN
Release R3 2019 (LIB 2019.2.708)
Hello, 
I would like set timeline start at the same date like scheduler. 
But sometimes it don't refresh (see attachment).
What can I do?
kind regards
Frank
Completed
Last Updated: 03 Sep 2019 07:00 by ADMIN
Release R3 2019

Please use the following code snippet to setup the Gantt view:

Sub New()

                 


        InitializeComponent()

        Dim dt As New DataTable
        dt.Columns.Add("ID", GetType(Integer))
        dt.Columns.Add("Group_ID", GetType(Integer))
        dt.Columns.Add("Title", GetType(String))
        dt.Columns.Add("Start", GetType(DateTime))
        dt.Columns.Add("End", GetType(DateTime))

        dt.Rows.Add(-999, 0, "Root", New DateTime(2019, 8, 21), New DateTime(2019, 8, 30))
        dt.Rows.Add(6, -999, "Item 1", New DateTime(2019, 8, 21), New DateTime(2019, 8, 23))
        dt.Rows.Add(7, -999, "Item 2", New DateTime(2019, 8, 26), New DateTime(2019, 8, 30))
        dt.Rows.Add(1000, 6, "Sub1.1", New DateTime(2019, 8, 21), New DateTime(2019, 8, 22))
        dt.Rows.Add(1001, 6, "Sub1.2", New DateTime(2019, 8, 22), New DateTime(2019, 8, 23))
        dt.Rows.Add(1002, 6, "Sub1.3", New DateTime(2019, 8, 23), New DateTime(2019, 8, 23))
        dt.Rows.Add(1003, 7, "Sub2.1", New DateTime(2019, 8, 26), New DateTime(2019, 8, 29))



        Me.RadGanttView1.DataSource = dt
        Me.RadGanttView1.ChildMember = "ID"
        Me.RadGanttView1.ParentMember = "Group_ID"
        Me.RadGanttView1.TitleMember = "Title"
        Me.RadGanttView1.StartMember = "Start"
        Me.RadGanttView1.EndMember = "End"

        Me.RadGanttView1.Columns.Add("ID")
        Me.RadGanttView1.Columns.Add("Title")
        Me.RadGanttView1.GanttViewElement.GraphicalViewElement.TimelineStart = New DateTime(2019, 8, 20)
    End Sub 

However, if you switch the order of adding the rows, not all items will be visible in RadGanttView:

dt.Rows.Add(1000, 6, "Sub1.1", New DateTime(2019, 8, 21), New DateTime(2019, 8, 22))
        dt.Rows.Add(1001, 6, "Sub1.2", New DateTime(2019, 8, 22), New DateTime(2019, 8, 23))
        dt.Rows.Add(1002, 6, "Sub1.3", New DateTime(2019, 8, 23), New DateTime(2019, 8, 23))
        dt.Rows.Add(1003, 7, "Sub2.1", New DateTime(2019, 8, 26), New DateTime(2019, 8, 29))

        dt.Rows.Add(-999, 0, "Root", New DateTime(2019, 8, 21), New DateTime(2019, 8, 30))
        dt.Rows.Add(6, -999, "Item 1", New DateTime(2019, 8, 21), New DateTime(2019, 8, 23))
        dt.Rows.Add(7, -999, "Item 2", New DateTime(2019, 8, 26), New DateTime(2019, 8, 30))

Completed
Last Updated: 14 Oct 2019 14:32 by ADMIN
Release R3 2019 SP1

Run the attached sample project and select the second page. You will notice that the tasks are missing. This used to work in R2 2019 (version 2019.2.508).

Workaround: Initialize the RadGanttView.BindingContext before adding it to the page:

        Dim Gantt As New RadGanttView
        Gantt.Dock = DockStyle.Fill
        Gantt.BindingContext = New BindingContext()
        RadPageViewPage2.Controls.Add(Gantt)

Completed
Last Updated: 07 Feb 2020 10:00 by ADMIN
Release R1 2020 SP1 (LIB 2020.1.210)

I have integration radscheduler and radganttview.

Load data

Dim ds as new DataSource

Dim dvAppointments As New DataView

Dim appointmentMappingInfo As New AppointmentMappingInfo()
        Dim SchedSource As New SchedulerBindingDataSource()
        appointmentMappingInfo.Mappings.Add(New SchedulerMapping("Kontrahent", "pln_kntakronim"))
        appointmentMappingInfo.Start = "pln_start"
        appointmentMappingInfo.End = "pln_stop"
        appointmentMappingInfo.Location = "pln_nr"
        appointmentMappingInfo.ResourceId = "pln_zamgidnumer"
        appointmentMappingInfo.Description = "pln_opis"
        appointmentMappingInfo.Resources = ""
        appointmentMappingInfo.Location = "pln_nrzam"
        appointmentMappingInfo.Summary = "pln_twrkod"
        appointmentMappingInfo.StatusId = "pln_status"

        dvAppointments.Table = ds.Tables("PlanowanieTamborow")
        SchedSource.EventProvider.Mapping = appointmentMappingInfo

        bsPlanowanie.DataSource = dvAppointments  'BindingSource
        SchedSource.EventProvider.DataSource = bsPlanowanie
    
        RadScheduler1.DataSource = SchedSource

        RadGanttView1.DataProvider = New GanttViewIntegrationProvider(RadScheduler1)

refresh data

Dim reader As System.Data.SqlClient.SqlDataReader = comm.ExecuteReader

 ds.Tables("PlanowanieTamborow").Clear()
 ds.Tables("PlanowanieTamborow").Load(reader)
 ds.Tables("PlanowanieTamborow").AcceptChanges()

 ds.Tables("PlanowanieTamborow")

 

If I refresh the Radscheduler then RadGanttView doesn't refresh

Radscheduleris working properly

 

Unplanned
Last Updated: 15 Sep 2021 11:33 by ADMIN

Please use the following code snippet. Activate the editor for a cell and click another cell:

private DataSet weddingPlan;
public DataSet WeddingPlan {
    get 
    { 
        if(weddingPlan == null)
        {
            weddingPlan = new DataSet();
            using (StreamReader rdr = new StreamReader("TelerikWeddingPlanner.xml"))
            {
                weddingPlan.ReadXml(rdr);
            }
        }

        return weddingPlan;
    }
}

public Form1()
{
    InitializeComponent();

    // Events
    this.radGanttView1.GanttViewElement.EditorRequired += GanttViewElement_EditorRequired;
    this.radGanttView1.GanttViewElement.EditorInitialized += GanttViewElement_EditorInitialized;
    this.radGanttView1.GanttViewElement.ItemValidating += GanttViewElement_ItemValidating;
    this.radGanttView1.GanttViewElement.ItemValidated += GanttViewElement_ItemValidated;
    this.radGanttView1.GanttViewElement.ItemEdited += GanttViewElement_ItemEdited;
}

private void GanttViewElement_DoubleClick(object sender, EventArgs e)
{
    Debug.WriteLine("GanttViewElement_DoubleClick");
}

private void GanttViewElement_EditorRequired(object sender, GanttViewEditorRequiredEventArgs e)
{
    Debug.WriteLine("GanttViewElement_EditorRequired");
    
}

private void GanttViewElement_EditorInitialized(object sender, GanttViewItemEditorInitializedEventArgs e)
{
    Debug.WriteLine("GanttViewElement_EditorInitialized");
    
}

private void GanttViewElement_ItemValidated(object sender, GanttViewItemValidatedEventArgs e)
{
    Debug.WriteLine("GanttViewElement_ItemValidated");
    
}

private void GanttViewElement_ItemValidating(object sender, GanttViewItemValidatingEventArgs e)
{
    Debug.WriteLine("GanttViewElement_ItemValidating");
    Debug.WriteLine(e.Column.FieldName);
    e.Cancel = true;
}

private void GanttViewElement_ItemEdited(object sender, GanttViewItemEditedEventArgs e)
{
    Debug.WriteLine("GanttViewElement_ItemEdited");
    
}

private void Form1_Load(object sender, EventArgs e)
{
    this.radGanttView1.DataSource = WeddingPlan;


    this.radGanttView1.GanttViewElement.TaskDataMember = "Tasks";
    this.radGanttView1.GanttViewElement.ChildMember = "Id";
    this.radGanttView1.GanttViewElement.ParentMember = "ParentId";
    this.radGanttView1.GanttViewElement.TitleMember = "Title";
    this.radGanttView1.GanttViewElement.StartMember = "Start";
    this.radGanttView1.GanttViewElement.EndMember = "Finish";
    this.radGanttView1.GanttViewElement.ProgressMember = "Progress";
    this.radGanttView1.GanttViewElement.LinkDataMember = "Links";
    this.radGanttView1.GanttViewElement.LinkStartMember = "StartId";
    this.radGanttView1.GanttViewElement.LinkEndMember = "EndId";
    this.radGanttView1.GanttViewElement.LinkTypeMember = "LinkType";

    this.radGanttView1.GanttViewElement.Columns.Add(new GanttViewTextViewColumn("Id"));
    this.radGanttView1.GanttViewElement.Columns.Add(new GanttViewTextViewColumn("ParentId"));
    this.radGanttView1.GanttViewElement.Columns.Add(new GanttViewTextViewColumn("Title"));
    this.radGanttView1.GanttViewElement.Columns.Add(new GanttViewTextViewColumn("Start"));
    this.radGanttView1.GanttViewElement.Columns.Add(new GanttViewTextViewColumn("Finish"));

    this.radGanttView1.GanttViewElement.Columns[0].Visible = false;
    this.radGanttView1.GanttViewElement.Columns[1].Visible = false;
    this.radGanttView1.GanttViewElement.Columns[2].Width = 350;
    this.radGanttView1.GanttViewElement.Columns[3].Width = 120;
    this.radGanttView1.GanttViewElement.Columns[4].Width = 120;

    this.radGanttView1.GanttViewElement.GraphicalViewElement.TimelineRange = TimeRange.Month;
    this.radGanttView1.GanttViewElement.GraphicalViewElement.TimelineStart = new DateTime(2006, 8, 21);
    this.radGanttView1.GanttViewElement.GraphicalViewElement.TimelineEnd = new DateTime(2007, 4, 3);

}

private void radGanttView1_ItemChildIdNeeded(object sender, GanttViewItemChildIdNeededEventArgs e)
{
    int max = int.MinValue;
    foreach (DataRow row in (this.radGanttView1.DataSource as DataSet).Tables[0].Rows)
    {
        if (int.Parse(row[0].ToString()) > max)
        {
            max = int.Parse(row[0].ToString());
        }
    }
    e.ChildId = ++max;
}

Unplanned
Last Updated: 05 Nov 2021 06:53 by ADMIN

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));

Completed
Last Updated: 23 Sep 2022 13:07 by ADMIN
Release R3 2022

Please refer to the attached sample project. After running it, the following error is observed:

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.WinControls.UI.RadPictureBoxElement.UpdateParentControl()
   at Telerik.WinControls.UI.RadPictureBoxElement.OnParentChanged(RadElement previousParent)
   at Telerik.WinControls.RadElement.SetParent(RadElement parent)
   at Telerik.WinControls.RadElement.ChangeCollection(RadElement child, ItemsChangeOperation changeOperation)
   at Telerik.WinControls.RadElementCollection.OnInsertComplete(Int32 index, Object value)
   at System.Collections.CollectionBase.System.Collections.IList.Add(Object value)
   at Telerik.WinControls.RadElementCollection.Add(RadElement value)
   at _1574930GanttCustomDataItem.RadForm1.customGanttViewTextViewCellElement.CreateChildElements() in C:\Projects\1574930GanttCustomDataItem\1574930GanttCustomDataItem\RadForm1.vb:line 75
   at Telerik.WinControls.RadElement.CallCreateChildElements()
   at Telerik.WinControls.RadElement.Construct()
   at Telerik.WinControls.RadElement..ctor()
   at Telerik.WinControls.RadItem..ctor()
   at Telerik.WinControls.UI.GanttViewTextViewCellElement..ctor(GanttViewTextItemElement owner, GanttViewTextViewColumn column)
   at _1574930GanttCustomDataItem.RadForm1.customGanttViewTextViewCellElement..ctor(GanttViewTextItemElement owner, GanttViewTextViewColumn column) in C:\Projects\1574930GanttCustomDataItem\1574930GanttCustomDataItem\RadForm1.vb:line 59
   at _1574930GanttCustomDataItem.RadForm1.radGanttView1_DataCellElementCreating(Object sender, GanttViewDataCellElementCreatingEventArgs e) in C:\Projects\1574930GanttCustomDataItem\1574930GanttCustomDataItem\RadForm1.vb:line 51
   at Telerik.WinControls.UI.RadGanttViewElement.OnDataCellCreating(GanttViewDataCellElementCreatingEventArgs e)
   at Telerik.WinControls.UI.GanttViewTextViewCellElementProvider.CreateElement(GanttViewTextViewColumn data, Object context)
   at Telerik.WinControls.UI.BaseVirtualizedElementProvider`1.GetElement(T data, Object context)
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.UpdateElement(Int32 position, T data)
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.LightVisualElement.MeasureElements(SizeF availableSize, SizeF clientSize, Padding borderThickness)
   at Telerik.WinControls.UI.LightVisualElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.VirtualizedStackContainer`1.MeasureElementCore(RadElement element, SizeF availableSize)
   at Telerik.WinControls.UI.VirtualizedStackContainer`1.MeasureElement(IVirtualizedElement`1 element)
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureElements()
   at Telerik.WinControls.UI.BaseVirtualizedContainer`1.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.GanttViewTextViewElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.UI.RadGanttViewElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.RootRadElement.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RootRadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.RadElementTree.PerformInnerLayout(Boolean performMeasure, Int32 x, Int32 y, Int32 width, Int32 height)
   at Telerik.WinControls.RadControl.OnLoad(Size desiredSize)
   at Telerik.WinControls.RadControl.LoadElementTree(Size desiredSize)
   at Telerik.WinControls.RadControl.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at Telerik.WinControls.UI.RadFormControlBase.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************

Workaround: set the RadOictureBoxElement.PanelDisplayMode property to PictureBoxPanelDisplayMode.None.

Unplanned
Last Updated: 21 Aug 2023 06:16 by ADMIN
1 2 3 4 5