Avalonia-是否可以使用可滚动的工具提示?

发布于 2025-01-31 05:26:48 字数 1315 浏览 3 评论 0原文

我有一个具有自定义控件的丰富工具提示。 自定义控件包含一个scollviewer,我希望在显示工具提示时使用鼠标轮滚动。

USERCONTROL本身很好,滚动作品,如果在正常视图中显示。

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

工具提示中显示的用户控件的摘录。

<UserControl>
  ...

    <ScrollViewer MaxHeight="800">
        <ItemsControl Items="{Binding HitList}" Margin="0,5,15,0">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </ScrollViewer>
</UserControl>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一袭水袖舞倾城 2025-02-07 05:26:48

由于它无法接收焦点。为此目的,更合适的控制是弹出,它具有相同的默认外观,并且将鼠标悬停在鼠标上时不会关闭。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文