Profile Picture

NComboBox designer issue

Posted By Etienne-Louis Nicolet 14 Years Ago
Author
Message
Nevron Support
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hello Etienne,

Items property of NComboBox class has attribute DesignerSerializationVisibility set to Content. This attribute tells to the designer to create these items.

To prevent adding items from the designer you need to hide the base Items property and set this attribute to hidden to the property that hides the base one:

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public new NListBoxItemCollection Items
{
    get
    {
        return base.Items;
    }
}

 



Best Regards,
Nevron Support Team



Etienne-Louis Nicolet
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 2, Visits: 1

(Using Visual Studio 2010 Professional, Nevron .Net Vision 2010.1)

 

I created a control that inherits from NComboBox ("MyNComboBox") as well as a class inheriting from NListBoxItem ("MyNListBoxItem"). MyNComboBox adds a MyNListBoxItem to its Items collection in the constructor.

Probably when building the project, the designer of the form or user control using MyNComboBox (usually but not always) adds one or more NListBoxItems (not the inherited MyNListBoxItems) to its items collection, all of them with the properties of the item I intend to add in the constructor.

How can I prevent this from happening?



Etienne-Louis Nicolet
Posted 23 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 2, Visits: 1

Dear Support-Team,

Many thanks, that was exactly what I was looking for!

Kind regards,

Etienne





Similar Topics


Reading This Topic