StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Creating a user controlExpand / Collapse
Author
Message
Posted 08/17/2006 11:31:38 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519
I know this  a basic question but I can't find any information on how to do this.  I have created a class based on the SFUserControl.  I add a listview to the control.  I now want to expose the listviews columns property on the new usercontrol.  I can expost it at design time but every time I reopen the form any values that were set are gone.  Maybe I just am exposing the property incorrectly.  Any help would be greatly appreciated.

Scott

Post #2227
Posted 08/17/2006 11:39:00 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
When you expose a collection property you have to set the designer serialization to allow for content.  This tells the Visual Studio form designer how to properly set the property when saving to the designer file.  You property will need to look something like this:

/// <summary>
        /// A custom collection exposed to a property sheet.  This sets the designer
        /// serialization to content so it will be properly saved within the form
        /// designer.
        /// </summary>
        /// <remarks></remarks>
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        public System.Collections.CollectionBase MyCollection
        {
            get
            {
                return _MyCollection;
            }
            set
            {
                _MyCollection = value;
            }
        }

Post #2228
Posted 08/17/2006 11:53:16 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 02/04/2008 8:43:02 AM
Posts: 176, Visits: 1,519

DesignerSerializationVisibility(DesignerSerializationVisibility.Content)

That was what I needed.  Thanks

Post #2230
Posted 08/17/2006 11:54:31 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Yesterday @ 7:08:30 PM
Posts: 4,811, Visits: 4,781
Glad to help
Post #2231
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 1:39am

Powered by InstantForum.NET v4.1.4 © 2008
Execution: 0.125. 12 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.