Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avalonia - Is it possible to have a scrollable tool tip?

I have a rich tooltip with a custom control. The custom control contains a scollviewer and I would like this to be scrollable with the mouse wheel, when the tooltip is shown.

The UserControl itself is fine and scrolling works, if shown in a normal view.

<ItemsControl Items="{Binding AllCards}" DockPanel.Dock="Top">
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapPanel/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <CardControl ToolTip.Placement="Right"
                         ToolTip.ShowDelay="10">
                <ToolTip.Tip>
                    <UserControl Content="{Binding Details}" MaxHeight="500"/>
                </ToolTip.Tip>
            </CardControl>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

Excerpt of the user control shown in the tooltip.

<UserControl>
  ...

    <ScrollViewer MaxHeight="800">
        <ItemsControl Items="{Binding HitList}" Margin="0,5,15,0">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </ScrollViewer>
</UserControl>
like image 406
NullReferenceException Avatar asked Dec 11 '25 04:12

NullReferenceException


1 Answers

It's not possible to scroll ToolTip content because it cannot receive focus. More appropriate control for this purpose would be a Popup, it has the same default looks and it will not close when you hover your mouse over.

like image 86
radoslawik Avatar answered Dec 13 '25 20:12

radoslawik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!