如何为图像制作工具提示,绑定到 GridColumn?

How make tooltip for image, bound to GridColumn?

答案很有帮助,但我还有另一个问题,与那个问题有关。

在我的程序中,GridColumn 中的每个图像都必须有自己的工具提示。所以我试着这样做:

                <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>

table中的数据根据​​一些输入参数发生变化,因此table中的行数不同。

问题是不是所有的图片都需要 (适当的)工具提示。奇怪的是:当最多有 6 行时,它运行良好。但是,如果更多 - 工具提示以随机顺序分配并且程序停止进入转换器中的调试点 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();
}

可能是我的绑定不正确,但我无法通过其他方式找到我的行数据...

我觉得自己很傻,因为那太容易了... 好吧,那是因为我已经尝试过像现在这样解决它,但是没有成功。 我的错误...现在可以了))

                        <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>