【发布时间】:2017-03-17 01:43:12
【问题描述】:
我在 DataGridCell 中使用了 ToolTip。
在我的项目中,我使用了 AvalonDock 并创建了 3 或 4 个窗口选项卡。
然后,它运行良好,工具提示在 DataGrid 中也显示良好,但 当我交换标签时出现错误。我认为加载程序...
这是我的 .xaml 代码的一部分。
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource MetroDataGridCell}">
<Setter Property="ToolTip" Value="{Binding Path=Content.Text, RelativeSource={RelativeSource Self}}" />
</Style>
</DataGrid.CellStyle>
成功了。 但是有错误说
System.Windows.Data 错误:40:BindingExpression 路径错误:在“对象”“ContentPresenter”(名称=“”)上找不到“文本”属性。绑定表达式:路径=内容.文本; DataItem='DataGridCell' (名称='');目标元素是'DataGridCell'(名称='');目标属性是“工具提示”(类型“对象”)
我该如何解决?
+加法 我修改了源代码。
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content}" />
然后,BindingExpression 错误消失了。但是 DataGridCell 的内容在显示 ToolTip 后消失了,就像我发布的图片一样!!奇怪的虫子!!!
【问题讨论】: