WPF工具提示绑定 [英] WPF Tooltip Binding
本文介绍了WPF工具提示绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我参加WPF仅两周了,所以这可能是一个琐碎的问题.我有一个"CellList"集合,该集合具有一些我想绑定到ToolTip
的属性,因此当我将鼠标悬停在CellList
的当前实例的标签信息上时,将显示该信息.我怎么做?我了解简单的绑定,这也可能是简单的绑定,但是我无法将其束之高阁.下面是我的XAML标签.有人可以向我解释我该如何做到这一点.
I am only two weeks into WPF so this is probably a trivial question. I have a collection "CellList" which has a few properties I would like to bind to a ToolTip
so when I hover over a label information from the current instance of CellList
is displayed. How do I do that? I understand simple binding and this maybe simple binding too but I can't wrap my head around it. Below is my XAML for the label. Could someone explain to me how I can accomplish this.
<HierarchicalDataTemplate>
<ListBox ItemsSource="{Binding CellList}">
<ListBox.ItemTemplate>
<DataTemplate>
<Label Content=" " Height="20" Width="15" Background="{Binding Path=ExptNameBkg, Converter={StaticResource ExptNameToBrushConverter}}" BorderBrush="Black" BorderThickness="1" >
</Label>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</HierarchicalDataTemplate>
谢谢.
推荐答案
<Label Content={Binding Path=Id} ToolTip={Binding Path=Name}/>
只需尝试
这篇关于WPF工具提示绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文