WPF背景图片ToolTip被上层ListBox遮挡的问题求助
WPF背景图片ToolTip被上层ListBox遮挡的问题求助
我最近在做一个功能,想在背景图片上标记一些位置,所以用了Grid布局把Image和ListBox叠在一起——ListBox的ItemsPanel用的是Canvas,这样能自由定位每个标记项。我的XAML代码大概是这样的:
<Grid> <Image Source="{Binding ImageSource}" ToolTipService.ToolTip="{Binding ImageToolTip}" /> <ListBox ItemsSource="{Binding ListSource}" Background="Transparent"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <Canvas IsItemsHost="True" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="Canvas.Left" Value="{Binding Left}" /> <Setter Property="Canvas.Top" Value="{Binding Top}" /> <Setter Property="Padding" Va... </Style> </ListBox.ItemContainerStyle> </ListBox> </Grid>
现在遇到个麻烦:背景Image的ToolTip会被上层的ListBox给挡住,鼠标移到图片区域的时候,ToolTip根本没法正常显示出来。有没有大佬能帮忙看看怎么解决这个问题呀?
备注:内容来源于stack exchange,提问作者Nostromo
相关产品推荐
相关产品推荐

