Hai All,
I have a EntityCollection and i was binded using xamgridname.Datasource=EntityCollection; and i gave auto generatedfields as false.
In here i have first_Name and Last_Name as separate,But i want to show Name(Last_Name+First_Name) into a single column.
Is it Possible?
I'm interested in learning if there are any industry best practices for decorating existing domain objects with addition attributes for use by the UI. For example, if you just add a FullName property to that object, this would be easy. The idea came to me to subclass the existing object, adding the additional property. Sounds hokey, but ...
Anyway, you can bind to either the first name, the last name or the data item itself (the entire object with the individual properties) and then run the data item through a converter. The only difference that I'm aware of with choosing the item to bind to is change notification. If you bind to the first name and only the last name changes, the grid won't see that change to recompute the full name. I don't know what the behavior is (for notification) when binding to the data item as a whole.
<igDP:UnboundField Name="Full_Name" Binding="{Binding Path=DataItem, Converter={StaticResource FullNameConverter} }" />
Your converter would be something like this, but with better logic to handle missing segments of the name, etc.
internal class FullNameConverter : IValueConverter{ [ValueConversion(typeof(Person), typeof(string))] public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string fullName = String.Empty;
Person person = value as Person;
if (person != null) { fullName = string.Format("{0} {1}", person.First_Name, person.Last_Name); }
return fullName; }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; }}You can also use a bound field to an actual field and pass the DataItem into the converter as the parameter.
In the FieldLayout,
<igDP:FieldLayout>
<igDP:FieldLayout.Fields>
<igDP:Field Name="First_Name" Label="First Name">
<igDP:Field Name="Last_Name" Label="Last Name">
</igDP:FieldLayout>
But i want to show these two columns into Single Column(First_Name+Last_Name).Displays the First_Name and Last_Name as NAME.
I'm also interested.
I need to bind two DataRow values to a single Field.
In this field I've to insert an Image and a text corresponding to those values.
Any suggest?
Thanks, Andrea
Hi,
Could you please, provide more detailed information about your Entity collection and the expected final result( lauout in the xamDataGrid).
Best Regards,
Yanko