0

To whom this may concern:

I'd like to refer to the "Spline Scatter Line Chart" example in the SciChart Examples package. If I were to make this a CustomRenderableSeriesViewModel that I can set in a ViewModel class, how would I go about doing that?

I am using SciChart v4, and here's what I know so far:

  1. CustomRenderableSeriesViewModel : BaseRenderableSeriesViewModel
  2. ViewType = typeof(CustomRenderableSeries)

My code so far is:

public class CustomRenderableSeriesViewModel : BaseRenderableSeriesViewModel
{
    public override Type ViewType => typeof(CustomRenderableSeries);
}

How would I go about setting the IsSplineEnabled property of the CustomRenderableSeries through the CustomRenderableSeriesViewModel class?

FYI: I have looked here and the Worked Example – CustomRenderableSeries in MVVM link goes to the SciChart v5 User manual.

Can you please advise?

The Don
  • 343
  • 2
  • 13
  • Give your viewmodel a bool property called `EnableSpline`. Make sure it does the INPC stuff right. In the style try ``. I'm guessing that the viewmodel you're creating should be the DataContext for the series, but that's just a guess. If that fails, change to Value="{Binding EnableSpline, PresentationTraceSources.TraceLevel=High}"` and look at the VS Output pane at runtime for diagnostics. – 15ee8f99-57ff-4f92-890c-b56153 May 31 '18 at 15:43

1 Answers1

0

Try to add a property to the CustomRenderableSeriesViewModel class:

public class CustomRenderableSeriesViewModel : BaseRenderableSeriesViewModel
{
    public override Type ViewType => typeof(CustomRenderableSeries);

    private bool _isSplineEnabled;
    public bool IsSplineEnabled
    {
        get { return _isSplineEnabled; }
        set { SetValue(ref _isSplineEnabled, value, "IsSplineEnabled"); }
    }
}

...and bind it to the property of the CustomRenderableSeries in the style:

<Style TargetType="local:SplineLineRenderableSeries" x:Key="splineSeriesStyle"
       BasedOn="{StaticResource MvvmDefaultRenderableSeriesStyle}">
    <Setter Property="IsSplineEnabled" Value="{Binding IsSplineEnabled}"/>
</Style>

It's unclear whether this actually works - I haven't tested it - given the following open thread at SciChart.com: https://www.scichart.com/questions/question/setting-value-in-renderableseriesviewmodel

If it fails I recommend you to post a new comment there and wait for the official support team to come back to you. After all they claim to "pride themselves on excellence in technical support and want you to get a fast resolution to your request" so it shouldn't take long before you get an answer from Try to add a property to the CustomRenderableSeriesViewModel class:

public class CustomRenderableSeriesViewModel : BaseRenderableSeriesViewModel
{
    public override Type ViewType => typeof(CustomRenderableSeries);

    private bool _isSplineEnabled;
    public bool IsSplineEnabled
    {
        get { return _isSplineEnabled; }
        set { SetValue(ref _isSplineEnabled, value, "IsSplineEnabled"); }
    }
}

...and bind it to the property of the CustomRenderableSeries in the style:

<Style TargetType="local:SplineLineRenderableSeries" x:Key="splineSeriesStyle"
       BasedOn="{StaticResource MvvmDefaultRenderableSeriesStyle}">
    <Setter Property="IsSplineEnabled" Value="{Binding IsSplineEnabled}"/>
</Style>

It's unclear if this actually works given the following open thread at SciChart.com: https://www.scichart.com/questions/question/setting-value-in-renderableseriesviewmodel

If it fails I recommend you to post a new comment there and wait for the official support team to come back to you. SciChart claims to "pride themselves on excellence in technical support and want you to get a fast resolution to your request" so it shouldn't take long before you get an answer from @Dr. ABT or a member of his team.

mm8
  • 163,881
  • 10
  • 57
  • 88