dotNET
dotNET

Reputation: 35400

Binding Tooltip to a property

Why wouldn't the following style work?

<DataGridTemplateColumn.CellStyle>
    <Style TargetType="DataGridCell">
        <Setter Property="ToolTip" Value="{Binding Path=_FailCount, StringFormat='{}Fail Count = {0}'}" />
    </Style>
</DataGridTemplateColumn.CellStyle>

Upvotes: 0

Views: 483

Answers (2)

har07
har07

Reputation: 89285

Try to change your binding this way :

<Setter Property="ToolTip" Value="{Binding Path=[_FailCount], StringFormat='{}Fail Count = {0}'}" />

That should work given the DataContext is a DataRowView, because that's the way we access a column value from DataRowView object.

Upvotes: 1

Sajeetharan
Sajeetharan

Reputation: 222582

If you want to a cell, you can try ColumnHeader ,

  Style TargetType="{x:Type Custom:DataGridColumnHeader}">
       <Style.Triggers>
          <Trigger Property="IsMouseOver" Value="True">
              <Setter Property="ToolTip"  Value="{Binding Path=_FailCount, StringFormat='{}Fail Count = {0}'}", RelativeSource={RelativeSource Self}}"/>
          </Trigger>
       </Style.Triggers>
    </Style>

Upvotes: 0

Related Questions