Pre loader

How to move templated legend around by mouse drag?

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

i currently place my custom (templated) legend inside the Scichartsurface (via xaml).

How can I offer the feature to drag the legend with the mouse to any location on the surface? Please note that I also use mouse movements and clicks for several chart modifiers so most likely I would have to check whether the mouse is hovering over the legend when a left mouse click event is raised?

Could you please get me started with some ideas or thoughts as I am not sure how to approach this issue.

Thanks

Version
4.2
  • You must to post comments
0
0

Hi there,

Thanks for your question. I would suggest placing your custom legend in a CustomAnnotation, which can be moved inside a SciChartSurface. You will need to declare the legend explicitly, not via a LegendModifier:

            <SciChart:SciChartSurface.Annotations>

            <SciChart:CustomAnnotation CoordinateMode="Relative" X1="0" Y1="0" IsEditable="True">

                <SciChart:CustomAnnotation.Content>



                    <SciChart:SciChartLegend .../>



                </SciChart:CustomAnnotation.Content>

            </SciChart:CustomAnnotation>

        </SciChart:SciChartSurface.Annotations>

You can find more info about the SciChartLegend control in our FAQ.

Hope this helps!

Best regards,
Yuriy

  • bbmat
    Thank you @Yuriy, though I wonder how I would go about implementing this. “Annotations” of SciChartSurface is already data-bound to my view model and on the other hand my legend must be declared and defined within xaml. I know WPF allows “CompositeCollections” but this idea does not seem applicable here. Any ideas how to get around this issue? Thanks a lot.
  • 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