I want to show the contain object at the same level as main object. Is there are way to achieve this.
public class ClassA{ public string Field1 { get; set; } public string Field2 { get; set; } public ClassB { get; set; }} public class ClassB{ public string Field3 {get; set; }}
public class ClassA{ public string Field1 { get; set; } public string Field2 { get; set; } public ClassB { get; set; }}
public class ClassB{ public string Field3 {get; set; }}
I want Field1, Field2, Field3 to appear at the same level.
PS: I found the post with this subject in WPF forum, the example comes from that post :-)
If you can, add this property in classA:
public string Field3
{
get { return classB.Field3; }
set { classB.Field3 = value; }
}
If you can't, add an unbound column named Field3 and in InitializeRow event write this:
var item = e.Row.ListObject as ClassA;
e.Row.Cells["Field3"].Value = item.classB.Field3;
I have done what you have suggested. However I was looking for some smart way of doing this without having to repeat the fields. I read about some other grid control implementing this using custom attributes.