RadiantQ Forum
Product => WPF Gantt Package => Topic started by: vtunc on March 30, 2017, 04:22:34 PM
-
Hi,
Is it possible to store the status for each TreeItem, whether the item is expaned or collapsed? I have a two-dimensional list of elements. Meetings can be booked on each element. Now I want to save the layout so that after a new loading of the Gantt, the elements are displayed in the same form.
Here a short Example:
► Folder1 (collapsed -> Should be saved)
▼ Folder2 (expanded -> Should be saved)
Assignment1 (no Meetings)
▼ Assignment2 (expanded -> Should be saved)
Meeting1
Meeting2
► Assignment3 (collapsed -> Should be saved)
Assignment4
My question now: Is it possible to save and restore the status? If yes how?
Thanks and Regards,
Martin
-
Martin,
We are looking on this, will update you soon.
Thanks
Raja
-
Martin,
You can listen for "NodeExpansionStateChanged" event of FlexyTree in our Gantt to load the Gantt with persisted expanded state from Data and vice versa. Here is the code usage,
public MainPage()
{
InitializeComponent();
// Time scale zoom setting. Default is 25
this.fxgantt.BaseTimeUnitWidth = 40;
this.fxgantt.ItemsSource = SampleProjectData.GetSampleData();
this.fxgantt.TemplateApplied += new EventHandler(fxgantt_TemplateApplied);
}
bool onGanttLoad = true;
void fxgantt_Loaded(object sender, RoutedEventArgs e)
{
this.onGanttLoad = false;
}
void FlexyTree_NodeExpansionStateChanged(object sender, NodeExpansionStateChangedEventArgs e)
{
if (e.TreeViewItem.DataContext is Group)
{
if (this.onGanttLoad)
// Update Gantt expansion state from Data.
e.TreeViewItem.IsExpanded = ((Group)e.TreeViewItem.DataContext).IsExpanded;
else
// Update Data expansion state from Gantt.
((Group)e.TreeViewItem.DataContext).IsExpanded = e.TreeViewItem.IsExpanded;
}
}
Thanks
Raja
-
Raja,
Thank you for your quick help.
Could be my error that I have not informed you that I use the FlexyTable instead of the FlexyTree. Sorry for the fact that I can not find the solution myself so quick, but is there a possibility in FlexyTable?
Thanks,
Martin
-
Martin,
FlexyTable uses FlexyTree internally. So, you can listen for "NodeExpansionStateChanged" event of FlexyTree as we recommended. Here is the code for subscribing the event,
void fxgantt_TemplateApplied(object sender, EventArgs e)
{
this.fxgantt.FlexyTree.NodeExpansionStateChanged += new NodeExpansionStateChangedEventHandler(FlexyTree_NodeExpansionStateChanged);
}
Thanks
Raja
-
Hi Raja,
Thank you! This solution works very fine. =)
Thanks,
Martin