Reputation: 306
Why is tooltip not displaying when hovering item behind transparent control in WPF? How can i make the UserControl display the tooltip through the invisible control? I also tried with a rectangle instead of button, same result, no tooltip.
<Grid Height="100" Width="100">
<Rectangle Fill="Red" ToolTip="Tooltip is behind button" Height="20" Width="20" Margin="7,40,73,40"/>
<Rectangle Fill="Yellow" ToolTip="Also behind" Height="20" Width="20" Margin="67,40,13,40"/>
<Button Opacity="0" Background="Transparent" Height="100" Width="100"/>
</Grid>
Upvotes: 0
Views: 293
Reputation: 9827
Set IsHitTestVisible="False"
for the Button
.
EDIT #1 after user comments.
I think you should do this :
<Button BorderThickness="0" BorderBrush="Transparent" Background="Transparent" Height="100" Width="100">
<Grid Height="100" Width="100">
<Rectangle Fill="Red" ToolTip="Tooltip is behind button" Height="20" Width="20" Margin="7,40,73,40"/>
<Rectangle Fill="Yellow" ToolTip="Also behind" Height="20" Width="20" Margin="67,40,13,40"/>
</Grid>
</Button>
Upvotes: 1
Reputation: 1193
Set Panel ZIndex in order to bring your element to the front:
<Grid Height="100" Width="100">
<Rectangle Panel.ZIndex="2" Fill="Red" ToolTip="Tooltip is behind button" Height="20" Width="20" Margin="7,40,73,40"/>
<Rectangle Panel.ZIndex="1" Fill="Yellow" ToolTip="Also behind" Height="20" Width="20" Margin="67,40,13,40"/>
<Button Panel.ZIndex="0" Opacity="0" Background="Transparent" Height="100" Width="100"/>
</Grid>
Upvotes: 0