November 13, 2019, 02:53:58 AM

See more Support incidents in our old archived forum.

Author Topic: Refresh FlexyGantt  (Read 94 times)

Francesco Fantoni

  • Customers
  • Newbie
  • *
  • Posts: 9
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: 119
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: 119
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: 9
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: 119
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: 119
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);
}
}
}