Click here to Skip to main content
16,017,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I have a custom control in which I have a property of type TextBox. I wish the user to set it from the designer when he has this UserControl on his form. However, I only have the need to display only the TextBox and not the properties that a TextBox contains.
A similar example is when in a ListView, the LargeImageList property is displayed in the proeprty window, the properties of an ImageList control are not displayed as "nested properties". The User simply sets the ImageList from the existing ImageLists on the form and thats all.
I believe I have been able to put my question correctly.
I guess I have to tag the proeprty with some attribute. But googling did not yield anything. :( Any suggestions?
Thanks for reading this.
regards,
S
Posted
Comments
Toli Cuturicu 30-Aug-10 15:28pm    
[DefaultValue((string) null), SRDescription("ListViewLargeImageListDescr"), SRCategory("CatBehavior")]
public ImageList LargeImageList { get; set; }
There is no special Attribute there!
(I got this using Reflector)

1 solution

1. Make the TextBox inside your UserControl private.
2. Create a property in your UserControl which exposes the "hidden" TextBox's Text property.
3. Enjoy!
 
Share this answer
 
Comments
Siddhartha S. 30-Aug-10 13:19pm    
I guess my question was not clear....
That is why I gave the example...
As a consumer of th ecustome control I want to set the textBox itself from the designer!!
regards,
S
Toli Cuturicu 30-Aug-10 15:20pm    
Now I got it! Sorry, disregard my answer then.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900