【发布时间】:2020-07-18 13:36:44
【问题描述】:
我的 DataGridTextColumn 目前遇到一个小问题。
我想在 DataGridTextColumn 上显示工具提示,但前提是文本不为空。
我怎样才能做到这一点?我目前使用的代码:
<DataGridTextColumn IsReadOnly="True" Header="Person" Binding="{Binding SomeBinding, TargetNullValue='-'}" Width="Auto"
CellStyle="{StaticResource SomeStyle}"/>
搭配风格
<Style x:Key="SomeStyle"
TargetType="DataGridCell" BasedOn="{StaticResource InactiveStyle}">
<Style.Setters>
<Setter Property="ToolTip" Value="{Binding Path=SomeBinding}"/>
</Style.Setters>
</Style>
此代码确实为我提供了工具提示,但是,当没有文本时,它也会显示工具提示。如果有任何问题,请告诉我,我可以为您提供帮助。
【问题讨论】: