Designer serialization


Author
Message
Chan
Chan
Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)Advanced StrataFrame User (701 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,



When I drop ChildFormDialog control on form, it will "auto generate code below at designer.cs.



This.ChildFormDialog1.ParentForm = this;




For curiousity, I created a class to "subclass" ChildFormDialog component using association which able to drop on usercontrol..

I would like to auto generate code below when drop to user control.



This.ChildFormDialog.ParentForm = this.ParentForm;




However, It doesnt't work. It always give me code below.



This.ChildFormDialog.ParentForm = null;




How to do this?



My Current Code



[Browsable(false)]

public BaseForm ParentForm

{

get

{

if (_ParentForm == null && this.DesignMode)

{

IDesignerHost loDesigner = (IDesignerHost)this.GetService(typeof(IDesignerHost));



if (loDesigner != null)

{

if (!loDesigner.RootComponent.GetType().IsSubclassOf(typeof(MicroFour.StrataFrame.UI.Windows.Forms.UserControl))

&& loDesigner.RootComponent != this)

{

return _ChildFormDialog.ParentForm;

}

else

{

MicroFour.StrataFrame.UI.Windows.Forms.UserControl loUC = (MicroFour.StrataFrame.UI.Windows.Forms.UserControl)loDesigner.RootComponent;

return (BaseForm)loUC.ParentForm;

}

}

}



return this._ChildFormDialog.ParentForm;

}

set

{

_ParentForm = (BaseForm)value;

this._ChildFormDialog.ParentForm = (BaseForm)value;

}

}




Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Chan,

This goes beyond a simple post or reply.  You are getting into serialization within the designer which takes a good amount of explanation. 

You have to define the this when the control is dropped.  Since you have purchased StrataFrame, you also have the source code for reference purposes.  I recommend looking at the UserControl object and then looking at the SyncObject property.  This will at least get you started.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search