1

ここで問題。ItemsControlがあり、ユーザーがItemsControlの上にマウスを置いた場合にToolTipを表示したいと考えています。簡単そうですよね?

ここに例があります:

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

ウィンドウの幅を十分に小さくし、WrapPanelにアイテムをラップさせます。そして、ItemsControl にカーソルを合わせてみてください( ToolTipは表示されません) 。Label にカーソルを合わせます( ToolTipが表示されます)。

この動作が正しい理由と、この場合にツールヒントを強制的に表示する方法を教えてください。

4

1 に答える 1

5

ToolTipforは、 aItemsControlを指定するまで表示されません。BackgroundBrush

<ItemsControl Background="Transparent"
于 2012-07-31T09:09:06.330 に答える