Using StaticResource warns "Chart objects parent changed"

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
NielsUll
Posts: 19
Joined: Thu Jan 19, 2017 8:23 am

Using StaticResource warns "Chart objects parent changed"

Post by NielsUll » Thu May 04, 2017 7:48 am

We have several annotations and elements which use the same style.
So we tried to specifiy these in a static resource, e.g.

Code: Select all

<UserControl.Resources>
  <lcusb:LineStyle Color="Black" Pattern="Dash" x:Key="CursorLineStyle"/>
</UserControl.Resources>
And use them like this:

Code: Select all

  
<lcusb:ConstantLine LineStyle="{StaticResource CursorLineStyle}"/>
...
<lcusb:LineSeriesCursor LineStyle="{StaticResource CursorLineStyle}"/>
However, we get this warning in the log:
"Chart error Warning: Warning, Chart objects parent changed. This could indicate sharing chart's object between multiple parents, and that is not supported - Parent type changed from ConstantLine to LineSeriesCursor"

Is this scenario not supported? Do we need to copy/paste the definitions all over - some of them are much more complex than this?

ArctionKestutis
Posts: 557
Joined: Mon Mar 14, 2016 9:22 am

Re: Using StaticResource warns "Chart objects parent changed

Post by ArctionKestutis » Thu May 04, 2017 1:55 pm

Unfortunately styling is not currently supported for LightningChart objects (other than LC itself and maybe some few others). Styling for LC objects is on roadmap for some time already, but we did not have time to investigate the possibility of implementing it.

There is no easy workaround. You could try to do wrappers for the objects based on FrameworkElement class and implement the styling through that, but it might be quite cumbersome. Other option that comes to mind would be TypeConverters, which would set the default settings on object creation through XAML. Third option is that you could create some method that goes through the LC and its children and sets their settings.
Finally there is an option of customization of LightningChart. You could order the source package and set the default LC's "styles" or "themes" to your liking.

Warning "Chart objects parent changed" is introduced to identify problem, which arise from violation of LightningChart's tree-based object model viewtopic.php?f=29&t=973.

All the best.

Post Reply