SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components

0 votes
0 answers
168 views

My issue is that the Pointmarker does not draw when I attempt to implement a custom renderable series view model. I’ve isolated it to the fact I am subclassing because the same code will draw if I replace my custom subclass with the base class.

I subclassed XyScatterRenderableSeriesViewModel like so:

public class CustomSeriesViewModel : XyScatterRenderableSeriesViewModel
{
    public CustomSeriesViewModel ()
    : base()
    {
    }
}

It is created like this:

return new CustomSeriesViewModel ()
        {
            // Note: the Pointmarker is created in the Xaml. See styles.
            StyleKey = "CustomSeriesStyle",
            DataSeries = dataSeries,
            IsSelected = true,
        };

And added into a list of type List IRenderableSeriesViewModel

If I replace the line new CustomSeriesViewModel () with new XyScatterRenderableSeriesViewModel(), the Pointmarker is drawn successfully. This is confusing to me, as there’s no other code in the subclass than the constructor, so I would expect it to be substitutable.

The style is responsible for defining the Pointmarker and looks like this:

 <Style x:Key="CustomSeriesStyle" TargetType="s:BaseRenderableSeries" >
    <Setter Property="s:TooltipModifier.TooltipTemplate" Value="{StaticResource CustomTooltipTemplate}" />
    <Setter Property="s:TooltipModifier.TooltipContainerStyle" Value="{StaticResource CustomTooltipStyle}" />
    <Setter Property="PointMarker">
        <Setter.Value>
            <s:SpritePointMarker>
                <s:SpritePointMarker.PointMarkerTemplate>
                    <ControlTemplate>
                        <Grid>
                            <Ellipse Width="13" Height="13" Fill="White"/>
                            <Ellipse Width="9" Height="9" Fill="{StaticResource CustomBrush}"/>
                        </Grid>
                    </ControlTemplate>
                </s:SpritePointMarker.PointMarkerTemplate>
            </s:SpritePointMarker>
        </Setter.Value>
    </Setter>
</Style>
  • John Chow asked 2 months ago
  • last active 2 months ago
Showing 1 result
This template supports the sidebar's widgets. Add one or use Full Width layout.