1
问题出在这里。我有一个ItemsControl,并且我想要显示一个工具提示如果用户将鼠标悬停在ItemsControl。看起来很简单,对吧?为什么ItemsControl.ToolTip只有在鼠标悬停在其项目上时才可见
下面的例子:
<ItemsControl BorderBrush="Blue" BorderThickness="1">
<ItemsControl.ToolTip>
<ToolTip Content="Text" />
</ItemsControl.ToolTip>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<Label BorderBrush="Red" BorderThickness="1">One</Label>
<Label BorderBrush="Red" BorderThickness="1">Two</Label>
<Label BorderBrush="Red" BorderThickness="1">Three</Label>
<Label BorderBrush="Red" BorderThickness="1">Four</Label>
<Label BorderBrush="Red" BorderThickness="1">Five</Label>
<Label BorderBrush="Red" BorderThickness="1">Six</Label>
<Label BorderBrush="Red" BorderThickness="1">Seven</Label>
</ItemsControl>
制作窗宽足够小,让WrapPanel包装的物品。并尝试将鼠标悬停在ItemsControl的(工具提示不会出现),比悬停在标签(工具提示就会出现)。
为什么这种行为是正确的,在这种情况下如何强制工具提示出现?
你是摇滚乐!谢谢! – stukselbax 2012-07-31 09:11:56
我有一个悬停在ItemsControl中的网格类似的问题。看起来,除非您在控件上设置背景,否则如果您不在子元素上方,则鼠标悬停会落空。 – 2015-12-09 20:13:30