winforms - How to set DataPropertyName to a property of a Inherited object in C#? -
i have datagridview
, bindinglist
, bindingsource
fill it. objects i'm using fill datagridview
this:
public class mybaseclass { public int someproperty {get; set;} public mybaseclass(int sp) { someproperty = sp; } } public class myderivedclass : mybaseclass { public int anotherproperty {get; set;} public myderivedclass(int sp, int ap):base(sp) { anotherproperty = ap; } }
my datagridview
can have list both of objects, don't know how set datapropertyname
of datagrid column anotherproperty
in inherited class. possible?
it's possible. see answer: https://stackoverflow.com/a/22078353/2878550
refers fields, can adapt case implementing different logic in mycustomtypedescriptor.getproperties
method.
Comments
Post a Comment