Hello,
I have two objects implemented with CollectionBase framework, say MyParent
and MyChild.
MyChild object is embedded into MyParent and I need to bind some MyChild
properties via MyParent.
I would like to bind a MyChild property without need to create a property
copy into MyParent just to allow access to the MyChild's property because
this will duplicate my entire code.
So I have decided to bind the property through the MyParent object using a
reference to the MyChild object. To do that I have created a property called
"MyChildRef" inside MyParent which returns a reference to MyChild embedded
object.
According to VStudio manual I can do the following:
"You can also use a period-delimited navigation path when you bind to an
object whose properties return references to other objects (such as a class
with properties that return other class objects). "
So I expect that the following binding should work:
txtMyTextBox.SetDatabind(MyDataSource,"MyChildRef. PropInChild");
But this returns an error: "Cannot bind to property or column PropInChild on
DataSource."
So my questions are:
- Is is possible to do that?
- What is the best way to put an object embedded into another and access its
properties from the parent?
Regards,
Fernando Malard.