Hello, thank you for your last help. I still have a last question to my evaluation related to the gantt control.
Is there a possibility to get the tree-column expanded event in code behind? The goal is to load huge data on demand when
e.g. summary task is expanding on table side. For us this is a very important feature and basically neccessary.
Are there any plans or possibilitys to resolve this issue for our requirements?
Best Regards ... Robert
Is there a possibility to get the tree-column expanded event in code behind? The goal is to load huge data on demand when
e.g. summary task is expanding on table side. For us this is a very important feature and basically neccessary.
Are there any plans or possibilitys to resolve this issue for our requirements?
Best Regards ... Robert
8 Answers, 1 is accepted
0
Hello Robert,
Expanding/Collapsing of GanttTasks in RadGanttView can be achieved programmatically by using the RadGanttView.ExpandCollapseService.
For example, if we want to Collapse all items on a button click we can use the following code in the Button_OnClick(object sender, RoutedEventArgs e):
Similarly, we can use this.GanttView.ExpandCollapseService.ExpandItem(gt);
You can use this approach when the synchronization with your source is happening.
Hopefully this helps and is suitable for your scenario.
Regards,
Polya
Telerik
Expanding/Collapsing of GanttTasks in RadGanttView can be achieved programmatically by using the RadGanttView.ExpandCollapseService.
For example, if we want to Collapse all items on a button click we can use the following code in the Button_OnClick(object sender, RoutedEventArgs e):
if
(button.IsChecked ==
true
)
{
foreach
(var gt
in
this
.GanttView.TasksSource
as
IList<GanttTask>)
{
foreach
(var child
in
gt.Children)
{
this
.GanttView.ExpandCollapseService.CollapseItem(child);
}
this
.GanttView.ExpandCollapseService.CollapseItem(gt);
}
return
;
}
Similarly, we can use this.GanttView.ExpandCollapseService.ExpandItem(gt);
You can use this approach when the synchronization with your source is happening.
Hopefully this helps and is suitable for your scenario.
Regards,
Polya
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
robert
Top achievements
Rank 1
answered on 19 Sep 2014, 06:15 AM
Hello Polya,
thank you for your answer, but i not mean to expand and collapse items in code behind like in your sample.
I mean how determine on gridside when user is expanding a summary task. My goal is to
load the data from the childnodes later and insert these as children related to the summary task on demand.
Best Regards .. Robert ...
thank you for your answer, but i not mean to expand and collapse items in code behind like in your sample.
I mean how determine on gridside when user is expanding a summary task. My goal is to
load the data from the childnodes later and insert these as children related to the summary task on demand.
Best Regards .. Robert ...
0
Hi Robert ,
Thank you for your clarification.
Unfortunately, an expand/collapse state changed event is not available in the current implementation of the RadGanttView.
However, I've included this feature request in our Feedback portal: http://feedback.telerik.com/Project/143/Feedback/Details/138401-introduce-expandcollapsechanged-event where you can track its status and vote to raise its priority.
We apologize for the inconvenience caused.
Regards,
Polya
Telerik
Thank you for your clarification.
Unfortunately, an expand/collapse state changed event is not available in the current implementation of the RadGanttView.
However, I've included this feature request in our Feedback portal: http://feedback.telerik.com/Project/143/Feedback/Details/138401-introduce-expandcollapsechanged-event where you can track its status and vote to raise its priority.
We apologize for the inconvenience caused.
Regards,
Polya
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
Hi Robert,
After further investigation I can suggest an alternative event we can subscribe to in order to detect when a GanttTask has been expanded/collapsed.
We should handle the CollectionChanged event of the ExpandCollapseService.HierarchicalCollectionAdapter of the RadGanttView:
When the e.NewItems is not null - the task has been expanded and when e.OldItems is not null - the task has been collapsed.
Hopefully this helps and is suitable for your scenario.
Regards,
Polya
Telerik
After further investigation I can suggest an alternative event we can subscribe to in order to detect when a GanttTask has been expanded/collapsed.
We should handle the CollectionChanged event of the ExpandCollapseService.HierarchicalCollectionAdapter of the RadGanttView:
this
.gantt.ExpandCollapseService.HierarchicalCollectionAdapter.CollectionChanged += HierarchicalCollectionAdapter_CollectionChanged;
private
void
HierarchicalCollectionAdapter_CollectionChanged(
object
sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
//implement logic here
}
When the e.NewItems is not null - the task has been expanded and when e.OldItems is not null - the task has been collapsed.
Hopefully this helps and is suitable for your scenario.
Regards,
Polya
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
robert
Top achievements
Rank 1
answered on 17 Oct 2014, 12:25 PM
Hi Polya,
thank you for your further Investigation. With NewItems and OldItems it is possible
to detect the expand/collapsed state, but the CollectionChanged event is raised on every child during
collection is expanding. I need that the event is raised only at once on expand or collapsed.
Regards,
Robert
thank you for your further Investigation. With NewItems and OldItems it is possible
to detect the expand/collapsed state, but the CollectionChanged event is raised on every child during
collection is expanding. I need that the event is raised only at once on expand or collapsed.
Regards,
Robert
0
Hi Robert,
I tested the event and it was only raised once when GanttTask is expanding/collapsing. I tested it with the latest official release version of the controls. Can you please share some more details about the exact scenario? What version of the control are you using?
I'm looking forward to hearing from you.
Regards,
Kalin
Telerik
I tested the event and it was only raised once when GanttTask is expanding/collapsing. I tested it with the latest official release version of the controls. Can you please share some more details about the exact scenario? What version of the control are you using?
I'm looking forward to hearing from you.
Regards,
Kalin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Richard
Top achievements
Rank 1
answered on 20 Nov 2014, 12:56 PM
Hi Polya,
very interesting topic. I also need such a event to make something with load on demand.
My Problem is how to use it in MVVM? The
gantt.ExpandCollapseService.HierarchicalCollectionAdapter.CollectionChanged Event seems
to be very special. How can i declare this in XAML (Event to Command) and passing the value from e.NewItems ?
This would me help for my scenario.
Regards,
Richard
very interesting topic. I also need such a event to make something with load on demand.
My Problem is how to use it in MVVM? The
gantt.ExpandCollapseService.HierarchicalCollectionAdapter.CollectionChanged Event seems
to be very special. How can i declare this in XAML (Event to Command) and passing the value from e.NewItems ?
This would me help for my scenario.
Regards,
Richard
0
Hi Richard,
What I can suggest you would to implement a custom attached property that will be hooking to the event and executing a custom command in the ViewModel. So the attached property should be defined the following way:
Enable the helper the following way:
After the event is fire the CustomCommand from the ViewModel will be executed with the new items as a parameter.
Hope this helps.
Regards,
Kalin
Telerik
What I can suggest you would to implement a custom attached property that will be hooking to the event and executing a custom command in the ViewModel. So the attached property should be defined the following way:
public
class
GanttHelper
{
static
RadGanttView myGantt;
public
static
bool
GetIsEnabled(DependencyObject obj)
{
return
(
bool
)obj.GetValue(IsEnabledProperty);
}
public
static
void
SetIsEnabled(DependencyObject obj,
bool
value)
{
obj.SetValue(IsEnabledProperty, value);
}
// Using a DependencyProperty as the backing store for IsEnabled. This enables animation, styling, binding, etc...
public
static
readonly
DependencyProperty IsEnabledProperty =
DependencyProperty.RegisterAttached(
"IsEnabled"
,
typeof
(
bool
),
typeof
(GanttHelper),
new
PropertyMetadata(OnIsEnabledChanged));
private
static
void
OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if
(e.NewValue != e.OldValue)
{
myGantt = d
as
RadGanttView;
myGantt.ExpandCollapseService.HierarchicalCollectionAdapter.CollectionChanged -= HierarchicalCollectionAdapter_CollectionChanged;
myGantt.ExpandCollapseService.HierarchicalCollectionAdapter.CollectionChanged += HierarchicalCollectionAdapter_CollectionChanged;
}
}
static
void
HierarchicalCollectionAdapter_CollectionChanged(
object
sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
(myGantt.DataContext
as
ViewModel).CustomCommand.Execute(e.NewItems);
}
}
Enable the helper the following way:
<
telerik:RadGanttView
x:Name
=
"xGanttView"
local:GanttHelper.IsEnabled
=
"True"
>
After the event is fire the CustomCommand from the ViewModel will be executed with the new items as a parameter.
Hope this helps.
Regards,
Kalin
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.