How binding each column to other data source
i have datagridview and Object data source :开发者_如何学C
public class Data
{
public general general { get; set; }
public Person Person { get; set; }
}
public class general
{
public int Id { get; set; }
public int Name { get; set; }
}
public class Person
{
public int Tag { get; set;}
}
}
i want to bind first column to general.id and second to person.Tag, how i do this, its is possible to bind each column to other dataSource without add any code in data, person or general classes.
maybe need to add column manually?
Thanks
you can use a Listview to do this
http://www.switchonthecode.com/tutorials/wpf-tutorial-using-the-listview-part-1
another way is a linq query on your data and just extract the attributes you want
var erg = from d in datalist
select new { d.general.id, d.person.tag};
精彩评论