c# - 如何将鼠标键绑定到 HoverTrack?
问题描述
我本质上想切换鼠标左右键。我想用左边平移,用右键查看系列值。将左键绑定到平移工作正常,但是当我尝试绑定鼠标右键以查看数据时出现问题 - 如果我单击它一次,除非光标离开 PlotView,否则数据不会消失。它表现得好像我拿着它,而实际上我不是。我在下面提供了一些基本代码:
var plotViewMain = new PlotView();
var controller = new PlotController();
controller.UnbindAll();
controller.BindMouseDown(OxyMouseButton.Left, OxyPlot.PlotCommands.PanAt);
controller.BindMouseDown(OxyMouseButton.Right, OxyPlot.PlotCommands.HoverTrack);
plotViewMain.Controller = controller;
解决方案
PlotCommands.HoverTrack
只要鼠标悬停在点或轨迹上,就会显示数据。如果您希望仅在用户单击点或轨迹时显示数据点,您可能应该使用 PlotCommands.Track
controller.BindMouseDown(OxyMouseButton.Right, OxyPlot.PlotCommands.Track);
推荐阅读
- excel - Excel VBA:帮助在 Excel 中编辑 Outlook 电子邮件解析器
- list - pyspark 将混合类型的元组列表转换为数据框,给出空值
- swift - Xcode 构建错误 - 多个命令生成 .o,目标“ProjectCoreData”具有两次列出的 Swift 源文件的编译命令
- javascript - 如何使用 webpack-dev-server 运行后端代码?
- r - 从第一行共有的许多两列数据帧中读取、转置和合并数据帧
- c# - unity : 在字符 Select 中替代 Input.GetKey
- angular - 如何在Angular 6的生产版本中忽略规范文件和模拟文件
- c# - 使用 DataTable 值插入另一个 DataTable
- mysql - 即使一行为 NULL 也能获取数据
- sql - 为什么 ISNumeric() Transact-SQL 函数将一些 var-chars 视为 Int