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

0 votes
0 answers
5k views

Good day!
I have a problem with annotations. When I add them by double clicking on surface with this snippet of code:

private TextPointAnnotation LoadTextPointAnnotation(double x1, double y1)
        {
            var textPoint = new TextPointAnnotation
            {
                X1 = x1,
                Y1 = y1,
                ElementX2 = -10,
                ElementY2 = -5,
                ElementFontSize = 9,
                AnnotationName = "TXTAnnot" + _annotaionCount,
                ElementFontColor = Colors.Yellow,
                ElementWidth = 50,
                ElementHeight = 20,
                BorderBrush = new SolidColorBrush(Colors.Red),
                Background = new SolidColorBrush(Color.FromArgb(78, 255, 0, 0)),
                YAxisId = TextOfYAxis,
                IsHidden = !_isTextPointAnnotationsVisible,
                IsEditable = true,
                AnnotationCanvas = AnnotationCanvas.AboveChart,
                CanEditText = false
            };
            textPoint.ElementText = String.Format("{0}", textPoint.AnnotationName);
            textPoint.ContextMenu = BuildMenu(textPoint);
            textPoint.MouseMove += AnnotationMove;
            textPoint.MouseRightButtonDown += OnRightMouseAnnotationDown;
            textPoint.PreviewMouseLeftButtonDown += textPoint_PreviewMouseLeftButtonDown;
            textPoint.PreviewMouseMove += textPoint_PreviewMouseMove;
            AnnotationCollection.Add(textPoint);
            return textPoint;
        }

They are visible for mouse actions (for example, mouse move, mouse down and etc.)(Image 1)
But when I add them programmaticaly, for example in Loaded method- LoadTextPointAnnotation(100,200), they are not visible for mouse actions, that I’ve already mentioned above(Image 2).

What is the reason of strange behaviour?

Thanks in advance.

  • Egor asked 4 years ago
  • last active 4 years ago
0 votes
6k views

I want to implement a PopUpWindowAction and InteractionRequestTrigger via the Micrsoft PRISM Libray:
But it starts with basic problems:
I’m not able to create a correct invokeCommandAction, the RaisItemSelection method gets never executed?

Xaml:

<s:SciChartSurface>
  <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <i:InvokeCommandAction Command="{Binding MouseDoubleClickCommand}" CommandParameter="{}" />
                </i:EventTrigger>
    </i:Interaction.Triggers>
</<s:SciChartSurface>

xaml.cs:

MouseDoubleClickCommand = new DelegateCommand<object>(RaiseItemSelection);
 private void RaiseItemSelection(object obj)
        {
        }
Showing 2 results
This template supports the sidebar's widgets. Add one or use Full Width layout.