Pre loader

SeriesBinding on trigger

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

0
0

We recently upgraded from an old version of SciChart (3.1) and I’ve been updating our solution to use the latest binaries. Previously, we were setting the series source of a chart based on a trigger. However, after switching to the RenderableSeries=”{s:SeriesBinding …}” I discovered that we can’t use the SeriesBinding in a setter. Is there a way to do this with a trigger or do I need to do this in the code behind instead?

<Trigger Property="SelectedChannelSet" Value="0">
<Setter TargetName="DetailsChart" Property="SeriesSource" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ChartModel.ChannelOneAndTwoChartSeries}" />
</Trigger>
<Trigger Property="SelectedChannelSet" Value="1">
<Setter TargetName="DetailsChart" Property="SeriesSource" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ChartModel.ChannelThreeAndFourChartSeries}" />
</Trigger>

Thanks,

Tim

Version
6.2.1.13304
  • You must to post comments
0
0

I haven’t come across this before, but googling ‘Set MarkupExtension in style setter’ I found this forum post on MSDN.

Cannot convert the value in attribute ‘Style’ to object of type
‘System.Windows.Style’. ‘*MarkupExtension’ is not valid for
Setter.Value. The only supported MarkupExtension types are
DynamicResourceExtension and BindingBase or derived types.

So it seems WPF itself doesn’t let you set a MarkupExtension in a style setter, which is odd because (1) I would expect this to work, and (2) we ourselves use custom markup extensions in style setters in the scichart codebase.

For example we have code like this inside SciChart

<Style x:Key="SciChartSurfaceBase" TargetType="visuals:SciChartSurfaceBase">
    <!-- Both these are setters to markup extensions --> 
    <Setter Property="Background" Value="{me:ThemeBinding SciChartBackground}" />
    <Setter Property="BorderBrush" Value="{me:ThemeBinding GridBorderBrush}" />
...
</Style>

What exactly is the error you’re receiving and what is the code you’re trying to apply?

  • Tim Stephansen
    When I tried it says “No default constructor found.” Since we have the license which includes the source I found the SeriesBinding markup extension and created a new one called SeriesBindingExt with a default constructor. However, when I ran the application the chart had no data. The exact exception message using the series binding from SciChart is below. ‘No matching constructor found on type ‘SciChart.Charting.Common.MarkupExtensions.SeriesBinding’. You can use the Arguments or FactoryMethod directives to construct this type.’ Line number ‘783’ and line position ’75’. Inner Exception: No default constructor found for type ‘SciChart.Charting.Common.MarkupExtensions.SeriesBinding’. You can use the Arguments or FactoryMethod directives to construct this type. I ended up doing the following to remedy this issue. I created ChartSeries, ChannelsOneAndTwo, and ChannelsThreeAndFour properties. When the trigger value changes I set the ChartSeries property to either of the other two and it works. I’ll try the fallback value trick at some point when I get a chance. Thanks for the quick response!
  • 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