How to properly apply a color theme?

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
areus
Posts: 7
Joined: Wed Aug 12, 2015 11:09 am
Location: Germany

How to properly apply a color theme?

Post by areus » Wed Aug 12, 2015 11:19 am

We're just starting using the LightningChart, but there's a strange behavior with a really basic thing we're trying to play with. (We're using LightningChart 6.5.1.4001)

Here is our XAML markup, really simple:

Code: Select all

<lcu:LightningChartUltimate ColorTheme="LightGray">
    <lcu:LightningChartUltimate.ViewXY>
        <lcu:ViewXY/>
    </lcu:LightningChartUltimate.ViewXY>
</lcu:LightningChartUltimate>
Now, the problem is, that the color theme is applied only to the outer chart object, not to the XYView itself (it stays in the default dark theme). This is both in the designer and in runtime.
If we remove the view tag from the markup, it works. But obviously there's no possibility anymore to setup the chart view, it'll have all properties' values set to default.

Is there probably a point we're totally missing?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: How to properly apply a color theme?

Post by ArctionPasi » Fri Aug 14, 2015 10:07 am

You are right there's something strange in color theme setting in XAML. Since a new ViewXY is created in XAML, it uses the default colors defined for ViewXY which may be different than set in ColorTheme property.

There's a workaround, though. After InitializeComponent call, set color theme by code as follows:

Code: Select all


public MainWindow()
        {
            InitializeComponent();

            chart.ColorTheme = Arction.WPF.LightningChartUltimate.ColorTheme.LightGray;
        }
Then it goes through the object tree and applies theme colors. Note however, that if you have defined any colors for the objects yourself, ColorTheme overrides them all.

We will investigate what we can do to make it more consistent in setting by XAML.
LightningChart Support Team, PT

areus
Posts: 7
Joined: Wed Aug 12, 2015 11:09 am
Location: Germany

Re: How to properly apply a color theme?

Post by areus » Wed Aug 19, 2015 11:15 am

Thank you, this workaround works.

We update our custom colors in code after setting the color theme, there are only few of them.

Post Reply