我需要工具提示来按需检索一些慢速数据
ToolTip="{Binding FullPath, Converter={StaticResource SlowConverter}, IsAsync=True}"
我的转换器需要一秒钟才能从FullPath检索数据,除非用户将元素(ListBoxItem)悬停在工具提示中,否则我不希望它执行此操作。我希望Tooltip解决MouseOver上的绑定问题,但只要项目可见,它就会立即执行。
转换器是否只能在鼠标悬停时执行?
答案 0 :(得分:3)
尝试使用类似的触发器:
<Button Content="oK" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="ToolTip" Value="{Binding FullPath,Converter={StaticResource SlowConverter}}" ></Setter>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
我假设你的工具提示在一个按钮内。