expand event?

robert

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

Polya

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.

robert

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.

Polya

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:

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

Kalin

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.

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

Kalin

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...

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.