473,396 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VS2005: Collection properties not serialised by designer on custom controls

I have developed a custom control that, among others, includes a property that is a collection of "Items".

If I place an instance of my control onto a CF form, I can view all of the properties correctly in the property grid and my collection appears with the ellipses ready to open the collection editor. Click on the ellipses and the editor opens correctly and I can add and remove items in the collection.

Unfortunately, the incorrect code is generated when I close the designer, an example is below ...
//
// switchboard
//
this.switchboard.DisabledItemAction = TechnicalDirect.Windows.Forms.SwitchboardDisabledI temAction.Hide;
this.switchboard.Dock = System.Windows.Forms.DockStyle.Fill;
this.switchboard.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular);
this.switchboard.ItemHeight = 48;
this.switchboard.Location = new System.Drawing.Point(0, 0);
this.switchboard.Name = "switchboard";
this.switchboard.SelectedIndex = 0;
this.switchboard.Size = new System.Drawing.Size(312, 192);
this.switchboard.TabIndex = 0;
this.switchboard.Click += new System.EventHandler(this.switchboard_Click);
//
// switchboardItem1
//
this.switchboardItem1.Image = ((System.Drawing.Image)(resources.GetObject("switc hboardItem1.Image")));
this.switchboardItem1.Location = new System.Drawing.Point(0, 0);
this.switchboardItem1.Name = "switchboardItem1";
this.switchboardItem1.Size = new System.Drawing.Size(200, 200);
this.switchboardItem1.TabIndex = 0;
this.switchboardItem1.Text = "Logon";
Whilst this code looks fine, it is actually missing the part where the SwitchboardItem instance is added to the SwitchboardItems collection of the Switchboard control ...
this.switchboard.SwitchboardItems.Add(this.switchb oardItem1);
Has anybody seen this before, and if so, can you point me toward what I may have done wrong? I have not implemented any custom designers and my DesignTimeAttributes.xmta file contains an entry for the control with only the DesktopCompatible attribute specified.

Thanks.
Jun 26 '06 #1
1 1981
For anybody else that sees this problem, the answer is to specify <DesignerSerializationVisibility>DesignerSerializa tionVisibility.Content</DesignerSerializationVisibility> within the <Property name=""> tag.

"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message news:ud**************@TK2MSFTNGP05.phx.gbl...
I have developed a custom control that, among others, includes a property that is a collection of "Items".

If I place an instance of my control onto a CF form, I can view all of the properties correctly in the property grid and my collection appears with the ellipses ready to open the collection editor. Click on the ellipses and the editor opens correctly and I can add and remove items in the collection.

Unfortunately, the incorrect code is generated when I close the designer, an example is below ...
//
// switchboard
//
this.switchboard.DisabledItemAction = TechnicalDirect.Windows.Forms.SwitchboardDisabledI temAction.Hide;
this.switchboard.Dock = System.Windows.Forms.DockStyle.Fill;
this.switchboard.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular);
this.switchboard.ItemHeight = 48;
this.switchboard.Location = new System.Drawing.Point(0, 0);
this.switchboard.Name = "switchboard";
this.switchboard.SelectedIndex = 0;
this.switchboard.Size = new System.Drawing.Size(312, 192);
this.switchboard.TabIndex = 0;
this.switchboard.Click += new System.EventHandler(this.switchboard_Click);
//
// switchboardItem1
//
this.switchboardItem1.Image = ((System.Drawing.Image)(resources.GetObject("switc hboardItem1.Image")));
this.switchboardItem1.Location = new System.Drawing.Point(0, 0);
this.switchboardItem1.Name = "switchboardItem1";
this.switchboardItem1.Size = new System.Drawing.Size(200, 200);
this.switchboardItem1.TabIndex = 0;
this.switchboardItem1.Text = "Logon";
Whilst this code looks fine, it is actually missing the part where the SwitchboardItem instance is added to the SwitchboardItems collection of the Switchboard control ...
this.switchboard.SwitchboardItems.Add(this.switchb oardItem1);
Has anybody seen this before, and if so, can you point me toward what I may have done wrong? I have not implemented any custom designers and my DesignTimeAttributes.xmta file contains an entry for the control with only the DesktopCompatible attribute specified.

Thanks.
Jun 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
2
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
2
by: James Doran | last post by:
Hello, I'd like to iterate through each Page of my ASP.NET project from within a Custom web control and access the Page.Controls collection. I've tried using Reflection on the web project...
0
by: Simon | last post by:
Hi I have developed a custom webcontrol like a Table (A) with a rows collection property (collection derived from CollectionBase) where I put one or more custom webcontrol (B). I need to hide...
0
by: Jordan Bowness | last post by:
I make a similar post in another newsgroup, but this example is simplified somewhat. I have a component (cmpMyComponent) with 2 properties. The 1st property is a string value (Description) and...
3
by: Carlo \(MCP only\) | last post by:
Good afternoon I've developed some controls that holds specialized collections of items (a collection of ImageItems for a ImageComboBox, a collection of MenuItems for a Toolbar, etc.). The...
0
by: =?Utf-8?B?SGVsZ2U=?= | last post by:
Hi! I have run into a problem with visual inheritance using the VS2005 designer for Windows Forms. My goal is to put business logic and common rules for our controls into its own layer (base...
2
by: teixeira1985 | last post by:
Hi , Due an unknown cause VS2005 started to show an error when i switch from code to design in windows forms projects. I repaired the installation but the same happens. The error is: One or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.