3 Answers, 1 is accepted
0
Hi Sergey,
Thank you for writing.
You can bind a GanttViewDataItem to a textbox by using simple data binding. For example:
Let me know if you have additional questions.
Regards,
Dimitar
Telerik
Thank you for writing.
You can bind a GanttViewDataItem to a textbox by using simple data binding. For example:
GanttViewDataItem subitem11 =
new
GanttViewDataItem();
subitem11.Title =
"Sub-task.1.1 title"
;
textBox1.DataBindings.Add(
"Text"
, subitem11,
"Title"
,
true
, DataSourceUpdateMode.OnPropertyChanged);
Let me know if you have additional questions.
Regards,
Dimitar
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Sergey
Top achievements
Rank 1
answered on 11 Jun 2014, 04:29 PM
Dimitar thank you for your answer.
Here is one more question in this context
I've trying to bind GanttViewDataItem to entity framework ENTITY and cant find way how to do it.
Trying this i got a problem, moving edge of task (changing dates) didn't fire events:
void GanttViewElement_ItemValidated(object sender, GanttViewItemValidatedEventArgs e)
{
if (e.Item.Tag.GetType().BaseType.Name == "Task")
{
((Task)e.Item.Tag).tStartDate = e.Item.Start;
}
if (e.Item.Tag.GetType().BaseType.Name == "Project")
{
((Project)e.Item.Tag).pStartDate = e.Item.Start;
}
db.SaveChanges();
}
private void GanttViewElement_ItemEdited(object sender, GanttViewItemEditedEventArgs e)
{
if (e.Item.Tag.GetType().BaseType.Name == "Task")
{
((Task)e.Item.Tag).tStartDate = e.Item.Start;
}
if (e.Item.Tag.GetType().BaseType.Name == "Project")
{
((Project)e.Item.Tag).pStartDate = e.Item.Start;
}
db.SaveChanges();
}
But it works well when i'm changing dates in columns. Whats the problem?
Here is one more question in this context
I've trying to bind GanttViewDataItem to entity framework ENTITY and cant find way how to do it.
Trying this i got a problem, moving edge of task (changing dates) didn't fire events:
void GanttViewElement_ItemValidated(object sender, GanttViewItemValidatedEventArgs e)
{
if (e.Item.Tag.GetType().BaseType.Name == "Task")
{
((Task)e.Item.Tag).tStartDate = e.Item.Start;
}
if (e.Item.Tag.GetType().BaseType.Name == "Project")
{
((Project)e.Item.Tag).pStartDate = e.Item.Start;
}
db.SaveChanges();
}
private void GanttViewElement_ItemEdited(object sender, GanttViewItemEditedEventArgs e)
{
if (e.Item.Tag.GetType().BaseType.Name == "Task")
{
((Task)e.Item.Tag).tStartDate = e.Item.Start;
}
if (e.Item.Tag.GetType().BaseType.Name == "Project")
{
((Project)e.Item.Tag).pStartDate = e.Item.Start;
}
db.SaveChanges();
}
But it works well when i'm changing dates in columns. Whats the problem?
0
Hi Sergey,
Thank you for writing back.
In this case you can override the default gantt view behavior and invoke the ItemValidated method manually when an item is resized. For example you can use the following behavior:
This class can be used as follows:
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Thank you for writing back.
In this case you can override the default gantt view behavior and invoke the ItemValidated method manually when an item is resized. For example you can use the following behavior:
public
class
CustomGanttBehavior : BaseGanttViewBehavior
{
public
CustomGanttBehavior()
{
}
protected
override
void
ProcessMouseUpWhenResizingTask(GanttGraphicalViewBaseTaskElement element, MouseEventArgs e)
{
base
.ProcessMouseUpWhenResizingTask(element, e);
MethodInfo method =
typeof
(RadGanttViewElement).GetMethod(
"OnItemValidated"
, BindingFlags.Instance | BindingFlags.NonPublic);
GanttViewItemValidatedEventArgs args;
if
(element.Parent
is
GanttViewTaskItemElement)
{
args =
new
GanttViewItemValidatedEventArgs(((GanttViewTaskItemElement)element.Parent).Data,
null
);
}
else
{
args =
new
GanttViewItemValidatedEventArgs(((GanttViewSummaryItemElement)element.Parent).Data,
null
);
}
method.Invoke(
this
.GanttViewElement,
new
object
[] { args });
}
}
this
.radGanttView1.GanttViewBehavior =
new
CustomGanttBehavior();
I hope this helps. Should you have any other questions do not hesitate to ask.
Dimitar
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.