To reproduce: run the sample project and try to move a task.
Workaround:
Timer timer = new Timer();
private void DragDropService_Stopped(object sender, EventArgs e)
{
timer = new Timer();
timer.Interval = 300;
timer.Tick += timer_Tick;
}
private void timer_Tick(object sender, EventArgs e)
{
timer.Stop();
data.Tables["Tasks"].Clear();
}
Workaround 2:
private void radGanttView1_ItemElementCreating(object sender, Telerik.WinControls.UI.GanttViewItemElementCreatingEventArgs e)
{
if (e.Item.Items.Count == 0 && e.ViewElement is GanttViewGraphicalViewElement)
{
e.ItemElement = new MyGanttViewTaskItemElement(e.ViewElement as GanttViewGraphicalViewElement);
}
}
public class MyGanttViewTaskItemElement : GanttViewTaskItemElement
{
public MyGanttViewTaskItemElement(GanttViewGraphicalViewElement ganttViewBaseViewElement) : base(ganttViewBaseViewElement)
{
}
protected override Type ThemeEffectiveType
{
get
{
return typeof(GanttViewTaskItemElement);
}
}
public override void Detach()
{
var obj = this.Data;
this.Data.SuspendPropertyNotifications();
base.Detach();
obj.ResumePropertyNotifications();
}
public override void Synchronize()
{
DataSet ds = this.Data.GanttViewElement.DataSource as DataSet;
if (ds != null && this.Data != null)
{
DataRowView rowView = this.Data.DataBoundItem as DataRowView;
if (rowView != null && !RowExists(rowView.Row))//!ds.Tables[0].Rows.Contains(rowView.Row))
{
return;
}
}
base.Synchronize();
}
private bool RowExists(DataRow dataRow)
{
DataSet ds = this.Data.GanttViewElement.DataSource as DataSet;
bool res = false;
foreach (DataRow r in ds.Tables[0].Rows)
{
if (r.Equals(dataRow))
{
return true;
}
}
return res;
}
}