我无法在LineSeries上获得任何点击事件

时间:2013-10-25 08:32:04

标签: c# wpf xaml oxyplot

我尝试添加以下事件:

  • MouseDoubleClick
  • 的TouchEvent
  • 的MouseDown

所有这些都导致同一事件应该触发MessagBox(仅用于调试)但没有任何反应。我想我没有正确的活动......但如果我想在用户点击我的图表中的LineSeries中的某个点时捕获该事件,那是哪一个?

<oxy:Plot Grid.Column="0" Name="Plot" Title="Errors" MouseDown="Plot_MouseDown">            
    <oxy:Plot.Axes>
        <oxy:LinearAxis Position="Left" 
                MajorGridlineStyle="Solid" 
                MinorGridlineStyle="Dash" />
        <oxy:DateTimeAxis Position="Bottom" 
                MajorGridlineStyle="Solid" 
                MinorGridlineStyle="Dash" />                
    </oxy:Plot.Axes>
    <oxy:LineSeries ItemsSource="{Binding ErrorsByMinute}" DataFieldX="DateTime" 
                DataFieldY="Value" MarkerType="Circle" MarkerFill="#336699" 
                MarkerSize="4" Color="#336699" MouseDoubleClick="Plot_MouseDown" 
                TouchEnter="LineSeries_TouchDown" MouseDown="Plot_MouseDown" />
</oxy:Plot>        

1 个答案:

答案 0 :(得分:1)

你让他们在错误的地方......他们应该在剧情上,而不是LineSeries。

试试这个:

<oxy:Plot Grid.Column="0" Name="Plot" Title="Errors" MouseDown="Plot_MouseDown" 
    MouseDoubleClick="Plot_MouseDown" 
    TouchEnter="LineSeries_TouchDown" 
    MouseDown="Plot_MouseDown"
>            
    <oxy:Plot.Axes>
        <oxy:LinearAxis Position="Left" MajorGridlineStyle="Solid" MinorGridlineStyle="Dash" />
        <oxy:DateTimeAxis Position="Bottom" MajorGridlineStyle="Solid" MinorGridlineStyle="Dash" />                
    </oxy:Plot.Axes>
    <oxy:LineSeries ItemsSource="{Binding ErrorsByMinute}" DataFieldX="DateTime" DataFieldY="Value" MarkerType="Circle" MarkerFill="#336699" MarkerSize="4" Color="#336699"  />
</oxy:Plot>