I'm trying to set the DisplayMember Property of my ListBox in a windows forms project to a property of a nested class inside a Generic List I am binding to.
Here's a simple example:
public class Security
{
public int SecurityId { get; set;}
public SecurityInfo Info { get; set;}
}
public class SecurityInfo
{
public string Description { get; set;}
}
//........//
public void DoIt()
{
List<Security> securities = new List<Security>();
//add securities to list
lstSecurities.DataSource = securities;
lstSecurities.DisplayMember = "Info.Description";
}
Is this possible with a simple ListBox or will I have to create a subclassed ListBox to handle this?
edit:
I am trying not to modify these classes as they are being generated via a WSDL Document.