0

I'm trying to pass "Product" column value as a parameter to converter, as follows. I tried the following, it does not seem to work. (So, basically the value of "MappedName" field should be passed as a parameter.)

What am I missing here please?

xaml:

<converters1:NullTextConverter x:Key="nullTextConverter" />
   <dxg:GridColumn  FieldName="MappedName" Header="Product" Visible="True" FilterPopupMode="Excel" ShowInColumnChooser="True" Width="140"/>
      <dxg:GridColumn Header="Value" FieldName="Value" Visible="True" ShowInColumnChooser="False" ReadOnly="false" Width="260">
         <dxg:GridColumn.CellTemplate>
            <DataTemplate>
               <dxe:TextEdit HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" Width="215" FontSize="12" Text="{Binding RowData.Row.InputValue,Mode=TwoWay,  UpdateSourceTrigger=PropertyChanged}"  NullText="{Binding View.DataContext.NullText, Converter={StaticResource nullTextConverter}, ConverterParameter={Binding ElementName=MappedName}}"                                    ShowNullText="True" >

Viewmodel.cs:

this.NullText = "test";

public String NullText
{
   get { return _nullTextValue; }
   set
   {
      _nullTextValue = value;
      RaisePropertyChangedEvent();
   }
}

NulltextConverter:

public class NullTextConverter : IValueConverter
{
   public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
   {
      if (parameter != null)
      {
         return parameter.ToString();
      }
      return "";
   }

   public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
   {
      return "";
   }
}

Thanks.

Rob Goodwin
  • 2,676
  • 2
  • 27
  • 47
Vik K
  • 33
  • 4
  • Can you elaborate on "not working". Is it throwing an error, or is the text remaining null instead of return `String.Empty`? – Tronald Apr 23 '20 at 23:45
  • You can't use a binding as a ConverterParameter, [use a MultiBinding instead](https://stackoverflow.com/questions/15309008/binding-converterparameter). – Mark Feldman Apr 24 '20 at 02:09

0 Answers0