﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » Designer serialization</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 06 May 2026 07:04:54 GMT</lastBuildDate><ttl>20</ttl><item><title>Designer serialization</title><link>http://forum.strataframe.net/FindPost6330.aspx</link><description>Hi,&lt;br&gt;
&lt;br&gt;
When I drop ChildFormDialog control on form, it will "auto generate code below at designer.cs.&lt;br&gt;
&lt;br&gt;
[codesnippet]This.ChildFormDialog1.ParentForm = this;[/codesnippet]&lt;br&gt;
&lt;br&gt;
For curiousity, I created a class to "subclass" ChildFormDialog component using association which able to drop on usercontrol..&lt;br&gt;
I would like to auto generate code below when drop to user control.&lt;br&gt;
&lt;br&gt;
[codesnippet]This.ChildFormDialog.ParentForm = this.ParentForm;[/codesnippet]&lt;br&gt;
&lt;br&gt;
However, It doesnt't work. It always give me code below.&lt;br&gt;
&lt;br&gt;
[codesnippet]This.ChildFormDialog.ParentForm = null;[/codesnippet]&lt;br&gt;
&lt;br&gt;
How to do this?&lt;br&gt;
&lt;br&gt;
My Current Code&lt;br&gt;
[codesnippet]&lt;br&gt;
        [Browsable(false)]&lt;br&gt;
        public BaseForm ParentForm&lt;br&gt;
        {&lt;br&gt;
            get&lt;br&gt;
            {&lt;br&gt;
                if (_ParentForm == null &amp;&amp; this.DesignMode)&lt;br&gt;
                {&lt;br&gt;
                    IDesignerHost loDesigner = (IDesignerHost)this.GetService(typeof(IDesignerHost));&lt;br&gt;
&lt;br&gt;
                    if (loDesigner != null)&lt;br&gt;
                    {&lt;br&gt;
                        if (!loDesigner.RootComponent.GetType().IsSubclassOf(typeof(MicroFour.StrataFrame.UI.Windows.Forms.UserControl)) &lt;br&gt;
                            &amp;&amp; loDesigner.RootComponent != this)&lt;br&gt;
                        {&lt;br&gt;
                            return _ChildFormDialog.ParentForm;&lt;br&gt;
                        }&lt;br&gt;
                        else&lt;br&gt;
                        {&lt;br&gt;
                            MicroFour.StrataFrame.UI.Windows.Forms.UserControl loUC = (MicroFour.StrataFrame.UI.Windows.Forms.UserControl)loDesigner.RootComponent;&lt;br&gt;
                            return (BaseForm)loUC.ParentForm;&lt;br&gt;
                        }&lt;br&gt;
                    }&lt;br&gt;
                }&lt;br&gt;
&lt;br&gt;
                return this._ChildFormDialog.ParentForm;&lt;br&gt;
            }&lt;br&gt;
            set&lt;br&gt;
            {&lt;br&gt;
                _ParentForm = (BaseForm)value;&lt;br&gt;
                this._ChildFormDialog.ParentForm = (BaseForm)value;&lt;br&gt;
            }&lt;br&gt;
        }&lt;br&gt;
&lt;br&gt;
[/codesnippet]</description><pubDate>Sat, 27 Jan 2007 10:23:28 GMT</pubDate><dc:creator>Chan</dc:creator></item><item><title>RE: Designer serialization</title><link>http://forum.strataframe.net/FindPost6332.aspx</link><description>Chan,&lt;/P&gt;&lt;P&gt;This goes beyond a simple post or reply.&amp;nbsp; You are getting into serialization within the designer which takes a good amount of explanation.&amp;nbsp; &lt;/P&gt;&lt;P&gt;You have to define the this when the control is dropped.&amp;nbsp; Since you have purchased StrataFrame, you also have the source code for reference purposes.&amp;nbsp; I recommend looking at the UserControl object and then looking at the SyncObject property.&amp;nbsp; This will at least get you started.</description><pubDate>Sat, 27 Jan 2007 10:23:28 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>