May 31, 2020, 02:14:20 PM

See more Support incidents in our old archived forum.

Author Topic: Refresh FlexyGantt  (Read 5534 times)

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 15
Refresh FlexyGantt
« on: October 02, 2019, 05:25:09 PM »
Hi,
 Is there a way to refresh the content of FlexyGantt without rebind again the DataSource?
Sometime it's usefull to refresh the gantt because some properties of some items are changed even if the datasource reamins the same.
Currently I set the fxgantt.itemsource  property to null then assign again the same items collection to force update the fxgantt.

Thanks
Francesco

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 136
Re: Refresh FlexyGantt
« Reply #1 on: October 09, 2019, 03:45:57 PM »
Francesco,

We are looking on this, will update you soon.

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 136
Re: Refresh FlexyGantt
« Reply #2 on: October 11, 2019, 12:59:00 PM »
Francesco,

Is your data changes periodically and based on that you wanted to refresh the gantt? If yes, resetting the datasource is the best way. If not tell us the scenario when you wanted to refresh the gantt.

Thanks.

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 15
Re: Refresh FlexyGantt
« Reply #3 on: November 02, 2019, 07:43:15 PM »
Hi,
I apologize for late reply. I need to refresh the gantt when changing the graphical render of each task even the collection data remains the same. In my project there are lot of case, for example, if I want to switch from a color palette to another one, or if I need to show other information inside each box. Resetting the datasource takes some time, instead, in these cases, I'd like to have a faster way to render again the FlexyGantt. If the collection data changes then I obviously use datasource property.
Thanks for your support
Francesco

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 136
Re: Refresh FlexyGantt
« Reply #4 on: November 07, 2019, 06:44:20 AM »
Francesco,

Refreshing the view in WPF controls are not straight forward. We are looking for a best solution, will update you soon.

Thanks
Raja

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 136
Re: Refresh FlexyGantt
« Reply #5 on: November 08, 2019, 01:43:24 PM »
Here is a way to update the bindings in specific controls on an event like button click, in our task bars. You could use this approach on other controls' bindings, besides our task bars as well:

Code: [Select]
public void RefreshBindings(DependencyObject element, bool recurse)
{
if (element == null)
{
throw new ArgumentNullException("element");
}

foreach (PropertyDescriptor pd in TypeDescriptor.GetProperties(element,
new Attribute[] { new PropertyFilterAttribute(PropertyFilterOptions.All) }))
{
DependencyPropertyDescriptor dpd =
DependencyPropertyDescriptor.FromProperty(pd);

if (dpd != null)
{
if (BindingOperations.IsDataBound(element, dpd.DependencyProperty))
{
BindingOperations.GetBindingExpression(element, dpd.DependencyProperty).UpdateTarget();
}
}
}

if (recurse)
{
List<FrameworkElement> Children = new List<FrameworkElement>();
Extensions.GetChildren<FrameworkElement>(element, ref Children, true, false);

foreach (FrameworkElement item in Children)
{
RefreshBindings(item, false);
}
}
}

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 15
Re: Refresh FlexyGantt
« Reply #6 on: November 17, 2019, 05:11:47 PM »
Thanks for your advice but I don't get any improvements: the time the gantt takes to "refresh bindings" is the same as it takes if I use ItemSource property. This is because maybe the time that the gantt takes to "refresh" is due mainly to the rendering process, right? I'm afraid there is no solution. If you have other suggestions they'll be appreciated and if you plan to do some improvements in the rendering process in the future, I'll be happy to test and give you feedback.
Thanks
Francesco

ForumAdmin

  • Administrator
  • Jr. Member
  • *****
  • Posts: 88
Re: Refresh FlexyGantt
« Reply #7 on: November 18, 2019, 11:04:19 PM »
Francesco,

Thanks for the update. Yes, it appears that resetting the ItemsSource might be a cleaner solution.

We will update you if we come across a better way to do this.

Regards,
Praveen