stukselbax
stukselbax

Reputation: 5935

Why ItemsControl.ToolTip is visible only if mouse over its item

Here the problem. I have an ItemsControl, and I want to show a ToolTip if user hover mouse over ItemsControl. Seems easy, right?

Here an example:

<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>

Make window width small enough, and let WrapPanel to wrap an items. And try to hover over ItemsControl (ToolTip will not appears), than hover over Label (ToolTip will appears).

Why this behavior is right and how to force ToolTip to appears in this case?

Upvotes: 1

Views: 1420

Answers (1)

LPL
LPL

Reputation: 17083

ToolTip for ItemsControl doesn't show in any case until you give the Background a Brush.

<ItemsControl Background="Transparent"

Upvotes: 5

Related Questions