Can anyone show me the easiest way to combine two strings in an Unbound field that are the result of bindings? For example, I now have two columns, FirstName and LastName that are bound separately. I would like to "merge" these into one column, NAME. I DON'T want to change the code behind and what they are bound to currently.
Currently:
<igDP:UnboundField Name="FirstName" Label="First Name" BindingPath="FirstName" BindingMode="TwoWay" Width="60"/>
<igDP:UnboundField Name="LastName" Label="LastName" BindingPath="LastNamel" BindingMode="TwoWay" Width="60"/>
I want:
<igDP:UnboundField Name="Name" Label="Name" BindingPath="?????????????" BindingMode="TwoWay" Width="120"/>
Not sure what to do. Multibinding? Converter?
Thanks!
Hello,
The quickest way to achieve this would be to apply a converter to this field. Here is some sample code for the field and the converter :
<igDP:UnboundField Converter="{StaticResource conv}"/>
public class MyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
DataRecord dr = parameter as DataRecord ;
if (dr != null )
Person p = dr.DataItem as Person ;
if (p != null )
return p.FirstName + " " +p.LastName;
}
return Binding .DoNothing;
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
throw new NotImplementedException ();