【发布时间】:2020-07-17 08:20:32
【问题描述】:
我在工作中使用 OxyPlot 来显示一些信息。而且我需要更改默认工具提示,您可以在单击图表中的某个点后看到它。
目前,我有一个带有简单线性系列的测试 WPF 窗口。我已更改工具提示的模板以显示一些文本和按钮。
我的控制器:
public class PlotViewTest : PlotView
{ }
public class TestTracker : TrackerControl
{
public TestTracker()
{
CanCenterHorizontally = false;
CanCenterVertically = false;
}
}
我的 WPF 窗口代码:
<controlers:PlotViewTest Model="{Binding MyModel}">
<controlers:PlotViewTest.DefaultTrackerTemplate>
<ControlTemplate>
<controlers:TestTracker Position="{Binding Position}">
<Grid Margin="15">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Margin="5" Text="Hello world!"/>
<Button Grid.Row="1" Margin="5" Content="Start"/>
</Grid>
</controlers:TestTracker>
</ControlTemplate>
</controlers:PlotViewTest.DefaultTrackerTemplate>
</controlers:PlotViewTest>
我的 WPF 窗口:
但我想改变一些行为。
- 只有按住鼠标左键才能看到工具提示。当我打开它时,工具提示将被隐藏。但是我需要在红点上单击鼠标左键 1 次后始终显示工具提示。当我单击第二个红点时,将显示另一个工具提示。但是当我点击一些空白区域时,工具提示应该被隐藏。
- 当我在蓝线上按住鼠标左键时,也可以显示工具提示。但我想阻止它。只有当我点击红点时才会显示它。
如何改变这两种行为??
【问题讨论】: