WPF ListView项扩大在鼠标悬停 [英] wpf ListView item expand at mouseover
问题描述
我有时常pretty长listelement一个ListView。我想创建一个事件,在那里,如果我拖动鼠标在一个元素,整个名字出现在与该项目的全部文本工具提示般的小窗口。通过这种方式,用户可以读取它,即使它是为ListView窗口宽度过长。
I have a ListView with pretty long listelement at times. I would like to create an event, where if I drag the mouse over an element, the whole name appears in a tooltip-like small window with the whole text of the item. This way the user can read it even if it is too long for the ListView window width.
我有点卡住了,因为我发现为ListView元素没有鼠标悬停事件。我可能会去与我的ListView自定义样式,但我没有与样式的经验。
I am a bit stuck, because I find no MouseOver event for the ListView elements. I would probably have to go on with a custom Style for my ListView, but I don't have experience with Styles.
我真的AP preciate一点帮助,让我开始!
I would really appreciate a little help, to get me started!
推荐答案
感谢您的回答。试验了几个小时后,我设法解决它从XAML相当紧凑:
Thanks for the answer. After a few hours of experimenting, I managed to solve it quite compact from the xaml:
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="ToolTip" Value="{Binding Name}" />
</Style>
</ListView.ItemContainerStyle>
这篇关于WPF ListView项扩大在鼠标悬停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!