Alexey Titov
Alexey Titov

Reputation: 84

Can WPF UIElement show Tooltip without MouseOver?

Is it possible to display a ToolTip of an element if mouse/keyboard hasnt actually moved over that element? I know, that Popup would sound proper solution for that, but for my form I want to have ToolTips displayed over elements, few per time.

Upvotes: 1

Views: 1201

Answers (1)

mm8
mm8

Reputation: 169150

Is it possible to display a ToolTip of an element if mouse/keyboard hasnt actually moved over that element?

Yes, the ToolTip has an IsOpen property that you can set:

<TextBlock x:Name="tb" Text="..." xmlns:s="clr-namespace:System;assembly=mscorlib">
    <TextBlock.ToolTip>
        <ToolTip IsOpen="True" Placement="Bottom" PlacementTarget="{Binding ElementName=tb}"
                 HorizontalOffset="100" VerticalOffset="100">
            <TextBlock>Tooltip...</TextBlock>
        </ToolTip>
    </TextBlock.ToolTip>
</TextBlock>

Upvotes: 1

Related Questions