Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SvgViewbox doesn't show tooltip on mouse over

I'm using SharpVectors library in my WPF app to display SVG icons instead of the traditional PNGs. I'm using the following basic pattern throughout my XAML:

<Button ToolTip="My doodad">
    <svgc:SvgViewbox Height="16" Width="16" Margin="2" Source="pack://application:,,,/Resources/svg/mydoodad.svg" />
</Button>

The problem is that the tooltip I set on my button doesn't show through the SvgViewbox. It only shows when mouse is hovering over the button's 2px margin that isn't covered by the SvgViewbox element.

Contrast with this, where tooltip shows over the entire button surface, as expected:

<Button ToolTip="My doodad">
    <Viewbox Width="16" Height="16" Margin="2">
        <Image Source="pack://application:,,,/Resources/png/mydoodad.png"></Image>
    </Viewbox>
</Button>

I tried setting the tooltip on the SvgViewbox directly, but it makes no difference. What else can I do to make this work?

like image 221
aoven Avatar asked Sep 02 '25 15:09

aoven


1 Answers

I'm not familiar with SvgViewbox, but try to set property IsHitTestVisible to False for the SvgViewbox:

<Button ToolTip="My doodad">
    <svgc:SvgViewbox IsHitTestVisible="False" Height="16" Width="16" Margin="2" Source="pack://application:,,,/Resources/svg/mydoodad.svg" />
</Button>
like image 93
Rekshino Avatar answered Sep 05 '25 04:09

Rekshino