Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
558
Display Formatting Within Objects
posted

Hi,

 

I have a service that returns a list of parents where each parent has a property of Person which is simply:

string FirstName { get; set; };

string LastName {get; set;}

 

On my UI, I want to combine these properties into a grid column of format, "LastName, FirstName".  How can I achieve this?  Each time I attempt to even just display the first name, the column is populated with a value like, namespace.ServiceReference1.Person.  I tried to override the ToString method but that was not reflected in the UI.

 

Thanks,

Kyle

  • 69686
    posted

    Hello Kyle,

    You could create a get property that will return a concatenated formatted string of the FirstName and LastName properties. Another way would be to create an UnboundField and use a Converter (IValueConverter) that will do this.