Adding events on WPF LineSeries DataPoint

╄→гoц情女王★ 提交于 2019-12-02 03:24:34

As you said, The event triggers upon a click on any of the points because the event is assigned to the LineSeries. On this line (from your post)

<chartingToolkit:LineSeries DependentValuePath="Value" Name="lineSeries" IndependentValuePath="Key" ItemsSource="{Binding}" IsSelectionEnabled="True" MouseDoubleClick="lineChart_ShowResults_DoubleClick">

You were in the right path by going into LineSeries.DataPointStyle but I believe that you should define an event setter instead of a setter. Like this:

<chartingToolkit:LineSeries.DataPointStyle>
    <Style>
        <EventSetter>
            <EventSetter Event="Control.MouseDoubleClick" Handler="lineChart_ShowResults_DoubleClick"/>     
        </EventSetter>      
    </Style> </chartingToolkit:LineSeries.DataPointStyle>
</chartingToolkit:LineSeries.DataPointStyle>

And obviously remove the event handling on the LineSeries.

I did not try it, let me know if it works

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!