views:

20

answers:

1

hello,

i have datagridview and Object data source :

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

+1  A: 

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};
Patrick Säuerl