Hi,
I have a class like the following
class MyCompositeClass { private string property1 = "prop1"; [DisplayName("Identifier")] public string Property1 { get { return property1; } set { property1 = value; } } private string property2 = "Prop2"; public string Property2 { get { return property2; } set { property2 = value; } } private MyInnerClass innerClassObj = new MyInnerClass(); public MyInnerClass InnerClassObj { get { return innerClassObj; } set { innerClassObj = value; } } }
class MyInnerClass { public MyInnerClass() { mystring = "sadf"; } private string mystring = null; public string Mystring { get { return mystring; } set { mystring = value; } } }
i am binding a list of MyCompositeClass to the ultragrid like following
BindingList<MyCompositeClass> comp = new BindingList<MyCompositeClass> { new MyCompositeClass() ,new MyCompositeClass()}; ultraGrid1.DataSource = comp;
Can I show the public properties of MyInnerClass in the same band as the MyCompositeClass in some straightforward way?
Hello ,
If your inner class was a collection then UltraGrid will consider it as a child band. Since your MyInnerClass is not a collection then UltraGrid created column (single column ), for that field and uses ToString(); method in order to display value for the cells of that column. So if you want to display public properties of the MyInnerClass in the same band as MyCompositClass, you could use Reflection in order to get all public properties of your MyInnerClass and to create unbound column for each property and then to use InitiaLizeRow event of UltraGrid in order to fill the unbound columns cells with data.
Please let me know if you have any further questions.