C# IValueConverter,获取WPF DataGrid中行的其他值

C# IValueConverter,获取WPF DataGrid中行的其他值,c#,wpf,mvvm,datagrid,ivalueconverter,C#,Wpf,Mvvm,Datagrid,Ivalueconverter,我在做一个C#/WPF项目。我有一个绑定到模型的datagrid 如何在转换器中获得同一行的其他可用值 转换器示例: public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { int val = (int)value; return (int)(val / 0.41); } public object ConvertBack(object valu

我在做一个C#/WPF项目。我有一个绑定到模型的datagrid

如何在转换器中获得同一行的其他可用值

转换器示例:

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    int val = (int)value;

    return (int)(val / 0.41);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
    int val = (int)value;
    return (int)(val * 0.41);
}
装订的方式与图中所示相同 视图(XAML):



如何在转换器中获取当前行的其他值(例如“Name”)?

在TextBoxColumn中,而不是使用Value proeperty绑定到该行的整个DataContext

<DataGridTextColumn Header="Value" Binding="{Binding ,NotifyOnTargetUpdated=True, Converter={StaticResource Converter}}">

谢谢我正在搜索如何使用DataGridTemplateColumn的答案。也许有人可以告诉我,并缩短我的搜索。你可以用同样的方式使用它,你正在做的其他模板。。。如果您共享您的templatecolumn,将更容易为您提供解决方案###这是我希望让转换器运行的模板<代码>这样做没有帮助?这会引发异常。“Binding”后面不是少了一个逗号吗?但毕竟,它希望在绑定之后拥有一些属性。有什么想法吗?
<DataGridTextColumn Header="Value" Binding="{Binding ,NotifyOnTargetUpdated=True, Converter={StaticResource Converter}}">
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    Model model= value as Model;

    return (int)(model.Value/ 0.41);
}