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
210
How to get UltraGrid show the derived class properties of its DataDource
posted

I have Animal class and derived Cat class

: Class Animal

{

                Public String  Name{ get; set;}

}

Class Cat : Animal

{

                Public string  FurColor {get; set;}

}

Now I have ItemCollection<Animal> animals = new ItemCollection<Animal>(); with a few animal objects. Then I call UltraGrid1.DataSource = animals. The grid correctly shows the columns for the Animal properties.

If I populated the animal collection with a few cat objects. The grid only shows the properties of animal. No cat properties are shown as column of UltraGrid.

If I declare ItemCollection<Cat> cats  and set grid data source as cats. The cat properties will be shown in the UltraGrid  columns.

In WCF DataContractSerializer I can declare Cat as KnowType of Animal to get collection of anima l correctly recognized as cat. I s there a similar way for the UltraGrid  to show the actual data type  properties instead of only the base type.

Parents Reply Children