Avalonia-是否可以使用可滚动的工具提示?
我有一个具有自定义控件的丰富工具提示。 自定义控件包含一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于它无法接收焦点。为此目的,更合适的控制是
弹出
,它具有相同的默认外观,并且将鼠标悬停在鼠标上时不会关闭。It's not possible to scroll
ToolTip
content because it cannot receive focus. More appropriate control for this purpose would be aPopup
, it has the same default looks and it will not close when you hover your mouse over.