473,406 Members | 2,336 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,406 software developers and data experts.

adding designtime support for property of usercontrol (InitializeComponents)

I have a very simple UserControl (derived from
System.Windows.Forms.UserControl) that contains several ListViews. The
UserControl exposes a single public property:

public ListView.ColumnHeaderCollection Columns { get {...} };

When I use VS2005 designer's proprtygrid for that UserConrol to add new
Colums to the Collection everything works fine: The form that contains
the UserControl gets new members ( private
System.Windows.Forms.ColumnHeader columnHeader1, ...) in the
UserControl.Designer.cs also initializes each ColumnHeader inside
InitializeComponets().

There is one thing though that the designer fails to do: it does not
add the necessary:

this.userControl1.Columns.AddRange(new
System.Windows.Forms.ColumnHeader[]
{this.columnHeader1,this.columnHeader2,...});

into the InitializeComponent() Method in the UserControl.Designer.cs.

What do I need to do to make that happen ?

Aug 16 '06 #1
1 2968
Try adding the DesignerSerializationVisibility attribute

[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Content)]
public ListView.ColumnHeaderCollection Columns
{
get {...}
}

/claes

"bonk" <sc******************@gmx.dewrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>I have a very simple UserControl (derived from
System.Windows.Forms.UserControl) that contains several ListViews. The
UserControl exposes a single public property:

public ListView.ColumnHeaderCollection Columns { get {...} };

When I use VS2005 designer's proprtygrid for that UserConrol to add new
Colums to the Collection everything works fine: The form that contains
the UserControl gets new members ( private
System.Windows.Forms.ColumnHeader columnHeader1, ...) in the
UserControl.Designer.cs also initializes each ColumnHeader inside
InitializeComponets().

There is one thing though that the designer fails to do: it does not
add the necessary:

this.userControl1.Columns.AddRange(new
System.Windows.Forms.ColumnHeader[]
{this.columnHeader1,this.columnHeader2,...});

into the InitializeComponent() Method in the UserControl.Designer.cs.

What do I need to do to make that happen ?

Aug 17 '06 #2

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

Similar topics

0
by: dan | last post by:
Can I add design time support in the form of intellisence with the html tag of a UserControl(ASCX). If so how if not tell me that too.
4
by: DraguVaso | last post by:
Hi, I'm having some weird behaviour, and I can't find any solution to this. I made a UserControl (uclCommands) which contains a Toolbar (ToolBar1) with Modifiers = Public. I put this...
2
by: Emma | last post by:
Hi, I'm developing a GUI with almost all Usercontrols. It's been working wonderfull up till a few weeks ago, and really crashed yesterday. Suddenly I can no longer add some of my usercontrols...
2
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can assign values to the class object properties just...
5
by: Pieter | last post by:
Hi, I'm getting a really terrible and anoying bug/problem in VS.NET 2005: 1. Create a new Windows Application. 2. Add a new class Class1. 3. Add a usercontrol UserControl1. 4. Add a public...
2
by: Steve | last post by:
This is a weird one. I have a series of "SmartParts" which are CAB (Composite Application Block) Views which are finally just UserControls (99% of the time) Anyway, I layout my UserControl in...
0
by: Dst | last post by:
How can i resize my usercontrol in design mode ? Seems like when the usercontrol is added to a page the size is fixed. It does not have any resize grips. I added a width / height property and...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
3
by: arncota | last post by:
Hi, I created a UserControl, and created its UI with the designer. Next, I wanted to create a subclass of that UserControl, with a new UI. But when I open it in the designer, I see the UI...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.