Is it possible to bind complex type properties to a datagrid?

前端 未结 8 747
时光取名叫无心
时光取名叫无心 2020-12-02 15:55

How would I go about binding the following object, Car, to a gridview?

public class Car
{
   long Id {get; set;}
   Manufacturer Maker {get; set;}
}

public class         


        
8条回答
  •  生来不讨喜
    2020-12-02 16:41

        public class Manufacturer
        {
           long Id {get; set;}
           String Name {get; set;}
    
           public override string ToString()
           {
              return Name;
           }
        }
    

    Override the to string method.

提交回复
热议问题