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



Connecting to my latest reply on this thread
I still can’t make panes disappear correctly with multiple panes.

Here is the sample project demonstrating what you proposed on the previous thread, the first chartpane is shown but the panes do not resize.

Please make this project work as expected (i.e. there is 3 panes in the list, but only the second displayed in the list on the area of the 3 panes) to show me, how this works.



  • You must to post comments

Hi Kristóf,

Unfortunately, it isn’t possible with the current implementation because SciChartGroup was designed to work as it does. And although it allows customization, there isn’t any easy way to change this default behavior to the your desired one without rewriting the control. I’m not sure if there is something we can do to help you with this.

Thank you for understanding,

Best regards,

  • You must to post comments

Hi Yuriy,

I am sad to hear this, but i tried a workaround which you may be able to help with.
I bind the pane list called VisiblePanes to the ItemSource. Normally it is set to ChartPaneViewModels which contains all of the chart panes. When I want to display only one, I create a new list for VisiblePanes and add the only pane which i want to display. Like this:

public void MaximizePane(ChartPaneViewModel pVM)
if (pVM.IsMaximized == false) //not maximized, we will maximize it now
VisibleChartPanes = new ObservableCollection();
pVM.IsLastChartPane = true;
if (pVM.IsMaximized == true) //maximized, we will restore all others
pVM.IsLastChartPane = false;
VisibleChartPanes = ChartPaneViewModels;
ChartPaneViewModels[ChartPaneViewModels.Count – 1].IsLastChartPane = true;

The problem is that I also have an AnnotationCreationChartModifier, which throws a nullreference excption in the following case.
1., Maximize a pane
2., Display the multiple panes again
3., Tryin to create an annotation.

The stack trace looks like this:
following location: Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.FromCoordinates(Double xCoord, Double yCoord)
following location: Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.FromCoordinates(Point coords)
following location: Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.UpdatePosition(Point point1, Point point2)
following location: Abt.Controls.SciChart.ChartModifiers.AnnotationCreationModifier.OnModifierMouseUp(ModifierMouseArgs mouseButtonEventArgs)
following location: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.WB(IChartModifier C, ModifierEventArgsBase D)
following location: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.TB(Action2 C, ModifierEventArgsBase D)
following location: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.OnModifierMouseUp(ModifierMouseArgs e)
following location: Abt.Controls.SciChart.Utility.Mouse.MouseManager. (ModifierMouseArgs , IReceiveMouseEvents , Boolean )
following location: Abt.Controls.SciChart.Utility.Mouse.MouseManager. . . (IReceiveMouseEvents )
following location: Abt.Controls.SciChart.Common.Extensions.EnumerableExtensions. [ ](IEnumerable
1 , Action`1 )
following location: Abt.Controls.SciChart.Utility.Mouse.MouseManager. . (Object , MouseButtonEventArgs )

The Sichartsurface in the itemtemplate looks like this:
<s:SciChartSurface x:Name=”PART_ChartPaneView”
ViewportManager=”{Binding ViewportManager}”
SeriesSource=”{Binding ChartSeriesViewModels}”
Annotations=”{Binding ChartAnnotations,Mode=TwoWay}”


                        <!-- Bingin the visible range of the pane to the SurfaceViewModel's visible range, connecting all panes to 
                        share the same x axis-->
                            <s:DateTimeAxis VisibleRange="{Binding ParentViewModel.XVisibleRange, Mode=TwoWay}" 
                                                CursorTextFormatting="{Binding ParentViewModel.XAxisFormatting, Mode=TwoWay}" />

                        <!-- Binding the visible range of the pane to the paneviewmodel's visible range property -->
                                <s:NumericAxis VisibleRange="{Binding YVisibleRange, Mode=TwoWay}"/>

                                <s:ModifierGroup s:MouseManager.MouseEventGroup="ChartGroupMouseEvents">

                                    <s:AnnotationCreationModifier AnnotationCreated="annotationCreationModifier_AnnotationCreated"
                                                                  IsEnabled="{Binding ParentViewModel.IsAnnotationCreatorEnabled, Mode=TwoWay}"
                                                                  utils:AnnotationExtension.AnnotationStyle="{Binding ParentViewModel.ChartAnnotationStyle,Mode=TwoWay}"
                                                                  utils:AnnotationExtension.AnnotationType="{Binding ParentViewModel.ChartAnnotationType,Mode=TwoWay}">

                                    <s:VerticalSliceModifier Name="sliceModifier"

                                            <s:VerticalLineAnnotation Style="{StaticResource sliceStyle}"
                                                                      X1="{Binding ParentViewModel.SliceModifierPosition, Mode=TwoWay}">
                                    <s:CursorModifier ReceiveHandledEvents="True" />

Have you got any idea what is casing this?

  • You must to post comments

Hi Kristóf,

I think the reason is that the AnnotationCreationChartModifier gets detached when you remove a pane, but you still keep reference to it in a ViewModel. You should either recreate it, or, if you have binding to it, just check the IsAttached property. You shouldn’t use it when IsAttached is “False”, it will cause a NullReference exception.

Hope this helps!

  • You must to post comments

Hi Yurij,

How do I recreate it when it is declared this way in xaml and
I do not have reference to the AnnotationCreatorChartModifier itself?

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.