wpf - WPF 工具包图表:自定义数据点工具提示
问题描述
我想在显示 X 和 Y 值(独立和依赖值)的线序列的数据点上添加一个工具提示,而不仅仅是默认显示的依赖值。我知道这与这张票中写的问题相同 - WPF 工具包图表:自定义数据点标签
但是,我无法得到工作的答案。有一个链接指向似乎已过时的更多详细信息。
我的系列:
<DVC:Chart.Series>
<!--Have several lineseries that look like this, connected to a styling vm. Can add ToolTip=...-->
<VM:LineSeries x:Name="something"
Title="something"
DependentValuePath="Value"
IndependentValuePath="Key"
ItemsSource="{Binding something}"
DataPointStyle="{StaticResource DataPointBlue}"
>
</VM:LineSeries>
</DVC:Chart.Series>
我的数据点在此处设置样式,但添加带有任何工具提示的 setter 属性并没有什么不同:
<UserControl.Resources>
<Style x:Key="DataPointBlue" TargetType="{x:Type DVC:DataPoint}">
<Setter Property="Background" Value="Blue"/>
</Style>
</UserControl.Resources>
我已经尝试以各种方式在几个地方从上面链接的票证中添加这行代码,并且我已经尝试以各种方式使用 Binding,但没有任何效果。
<ToolTipService.ToolTip>
<StackPanel Margin="2,2,2,2">
<ContentControl Content="{TemplateBinding IndependentValue}" />
<ContentControl Content="{TemplateBinding DependentValue}" />
</StackPanel>
</ToolTipService.ToolTip>
这是许多没有取得进展的试验和错误。
解决方案
推荐阅读
- c++ - 如何使gdb仅输出到文件
- c - 打印笑脸
- database - JPA如何设计多个表与公用表的一对一关系
- git - 告诉 Git 使用几个自签名证书作为受信任的
- reactjs - 大型 react-final-form 分布在多个部分
- c++ - 在 C++ 中,如何将 uint16_t 变量传递给带有参数 unsigned int & 的函数?
- jquery - $.fn 链方法 - 调用变量
- html - 单击时引导菜单图标向上移动
- docker - 在私有管道中设置 VSTS 代理的 docker 权限
- websphere - Websphere 7.0 - 为什么 Web 服务器插件属性不可编辑