tca*_*les 5 wpf image tooltip string-formatting
我在列表框内的图像上有一个工具提示.工具提示设置如下:
<Image Grid.Column="0" Source="{Binding PingRankImage}"
Width="16" Height="16"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Image.ToolTip>
<ToolTip Content="{Binding Ping, StringFormat='Ping: {0}ms'}"
ContentStringFormat="{}Ping: {0}ms}" />
</Image.ToolTip>
</Image>
Run Code Online (Sandbox Code Playgroud)
但工具提示只显示值而不是'Ping:XXXms'
有任何想法吗?
您不需要额外的{}前缀ContentStringFormat.使用ToolTip,也更喜欢使用ContentStringFormat而不是StringFormat绑定.
以下作品:
<Image.ToolTip>
<ToolTip Content="{Binding}"
ContentStringFormat="Ping: {0}ms" />
</Image.ToolTip>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14913 次 |
| 最近记录: |