The built in .NET data grid view does NOT support nested binding (Address.Address1). I believe it works with simple databinding, but not complex databinding. We had to work around this limitation too. It isn't related to our product. It is a known limitation of the .NET framework controls in WinForms.
The easiest way to get nested values is to use the dynamic keyword, like so:
Code: Select all
dynamic order = GetAnOrder();
var adr = (string)order.Properties[0].Address.Address1
An alternative way is to use our Query extension method, located in SoftPro.ClientModel. It works like a XPath statement against objects, like so:
Code: Select all
object oder = GetAnOrder();
var adr = order.Query("Properties[0]/Address/Address1").Cast<String>().Single();
And finally, you can always do it the old fashion way, like so:
Code: Select all
IOrder order = GetAnOrder();
IList properties = order["Properties"];
IOrderItem property = (IOrderItem)properties[0];
IOrderItem address = property["Address"];
string adr = (string)address["Address1"];
You are following the correct steps to add an item to the collection. You need to create a new instance (via CreateNew) and then add it the model, using Add method (in the case of a collection) or property assignment (in the case in a property).
The EndNew function is related to the .NET data binding interfaces and shouldn't be used by your code. It is used by the .NET framework.