Pre loader

How to invalidate CustomRenderableSeries

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

I’m developing a CustomRenderableSeries with several dependency properties that controls how the series is displayed. When one of these properties changes I’d like to invalidate the series and have it redraw. What’s the best way to do this?

Version
6
  • You must to post comments
Best Answer
0
0

Hi Paul

There’s a static method in the BaseRenderrableSeries class called OnInvalidateParentSurface. If you set that as the property notifier then the parent surface will be invalidated.

public class MyRenderableSeries : CustomRenderableSeries
{
    public static readonly DependencyProperty FooProperty = DependencyProperty.Register(
        "Foo", typeof(bool), typeof(MyRenderableSeries), new PropertyMetadata(default(bool), OnInvalidateParentSurface));

    public bool Foo
    {
        get { return (bool) GetValue(FooProperty); }
        set { SetValue(FooProperty, value); }
    }
}

Alternatively, if you need a bit more customisation you can create a handler like this.

public class MyRenderableSeries : CustomRenderableSeries
{
    public static readonly DependencyProperty FooProperty = DependencyProperty.Register(
        "Foo", typeof(bool), typeof(MyRenderableSeries), new PropertyMetadata(default(bool), MyCustomHandler));

    private static void MyCustomHandler(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        // Do some logic here with d, e.

        // Then call OnInvalidateParentSurface
        OnInvalidateParentSurface(d, e);
    }

    public bool Foo
    {
        get { return (bool) GetValue(FooProperty); }
        set { SetValue(FooProperty, value); }
    }
}

Let me know if this helps!

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies