>> Again, in frameworks that compile to classes, this makes sense. When I
>> define MyClass.xaml and MyClass.cs, they are both combined such that the
>> following both instantiates and initializes the class:
>> 
>>  MyClass myClass = new MyClass();
>> 
>> But this doesn't work for BXMLSerializer.
>> 
> I am not totally familiar with the blending you describe but I don't
> think that object instantiation and initialization are directly tied to
> blending. I am not claiming that "you" create the element directly, just
> that the bxml file holds parts of the freeze dried version of the object
> whether you create the root object in code or bxml. In xaml, I don't think
> there are there are any "do an include to include your object" and you
> should not have to (but its an option), in pivot.

Includes aren't strictly necessary in XAML or MXML because both of those are 
compiled to classes that can then be referred to directly as elements. For 
example, if I create MyClass.mxml, I can then use <MyClass> in another MXML 
file. Since BXML is not compiled, we use includes to achieve the same type of 
behavior.

To your other point - bind() isn't meant to be a means for initializing all 
possible member variables. BXML's primary means of initializing member 
variables is via elements and attributes (i.e. bean setter methods). Binding is 
simply a convenience for mapping variables defined in BXML (either with bxml:id 
or in script) to internal member variables that you don't necessarily want to 
expose via a bean property. And of course you can always perform additional 
initialization in your class constructor itself.


Reply via email to