Recently, I have posted a question about binding image to GridColumn
The answer was helpful, but I have another problem, related to that issue.
In my program each image in GridColumn must have own tooltip. So I try to do it like this:
<dxg:GridColumn Header="MyColumn" ReadOnly="True" VisibleIndex="0" AllowResizing="False" Width="20*"
HorizontalHeaderContentAlignment="Center"
FieldName="Image">
<dxg:GridColumn.CellStyle>
<Style xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle}}"
TargetType="dxg:LightweightCellEditor">
<Setter Property="ToolTip" Value="{Binding BindsDirectlyToSource=True, Converter={StaticResource xMyImageConverter}}"/>
<Setter Property="ToolTipService.ShowDuration" Value="30000"/>
</Style>
</dxg:GridColumn.CellStyle>
<dxg:GridColumn.EditSettings>
<dxe:ImageEditSettings MaxWidth="15" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
The data in the table changes, depending on some entering parameters, so there is different amount of rows in the table.
The problem is that not all images has got needing (appropriate) tooltip. And what is strange: it works well, when there are up to 6 rows. But, if more - tooltips are assigned in random order and the program stops entering into debug points in converter class.
public class RiskTypeToRiskDescriptionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (((DevExpress.Xpf.Grid.GridCellData)value).RowData.Row as MyClass).MyTooltipText;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
=> throw new NotImplementedException();
}
May be my binding is not correct, but I cannot find my row data in another way...
I feel stupid, because that's so easy... Well, that's because I've already tried to solve it like now, but it didn't work. My mistake... Now it works))
<dxg:GridColumn.CellStyle>
<Style xmlns:dxgt="http://schemas.devexpress.com/winfx/2008/xaml/grid/themekeys"
BasedOn="{StaticResource {dxgt:GridRowThemeKey ResourceKey=LightweightCellStyle}}"
TargetType="dxg:LightweightCellEditor">
<Setter Property="ToolTip" Value="{Binding RowData.Row.MyToolTipText}" />
</Style>
</dxg:GridColumn.CellStyle>