473,386 Members | 1,766 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,386 software developers and data experts.

custom properties , usercontrols

2G
Hi,

I have a usercontrol with a custom propertie but in the designer, the
properties doesn't expand it's properties so I can't change them. I've
search google on this and came across things like
DesignerSerializationVisibilityAttribute and Type/ReferenceConverters but
can't find a good example on how to actually do this and don't know if this
is what I need.
Also, after it is possible to change the property in the designer, will the
change be saved in the code? I've had previous problems where I could change
the property (when the property class inherits from Component) but the
changes were not saved.
public class UserControl1: UserControl{

public UserControl1(){}

private Border border;

[Browsable(true),

DesignerSerializationVisibilityAttribute(DesignerS erializationVisibilityAttr
ibute.Content]
public Border Border{
get{ return this.border; }
set{
this.border = value;
}
}
}

[DefaultPropertie("Color")]
public class Border{

public Border():this(Color.Black){}

public Border(Color c){
this.Color = c;
}

private Color color;

[Category("Appearance"),
Browsable(true)]
public Color Color{
get{ return this.color; }
set{ this.color = value; }
}
}

thanks.
Nov 16 '05 #1
1 1601
hi 2G!!
you can use the property attributes that should be used with user
controls
The following is a list of some of the property attributes and their
descriptions.
Property Attributes Description
Browsable Specifies whether a property or an event
should be displayed in the Properties
window.
Category Specifies the name of the category in
which to group a property or event. When
categories are used, component properties
and events can be displayed in logical
groupings in the Properties window.
Description Defines a small block of text to be
displayed at the bottom of the Properties
window when the user selects a property
or event.
DefaultProperty( I guess you do use that one ) Specifies the default
property for the
component. This property is selected in
the Properties window when a user clicks
the control.
DefaultValue Sets a default value for a property.
TypeConverter Specifies the type converter to use for
converting the type of the property to
another data type.
Editor Specifies the editor to use for editing
(changing) a property in the Visual
Designer.
RefreshProperties Indicates how a designer refreshes when
the associated property value changes.
This class cannot be inherited.
You can use this this way
[Category("Appearance")]public Color MyBackColor // your implementation

And this way I belive your design time changes will persist in the code
…….

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #2

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

Similar topics

0
by: darrel | last post by:
Thanks to some help from Karl yesterday, I've discovered the use of Interfaces to allow usercontrols to communicate information between them using the Interface as the 'parent' rather than the aspx...
3
by: Garth17 | last post by:
I'm trying to figure out a solution for sharing common properties and methods in all me .aspx and .ascx pages. In classic ASP I would use include directives. So far I have made 2 base classes...
1
by: luminousc | last post by:
Hi guys, I'm still a relative newbie at oop, as my background has been in old fashioned vanilla ASP, so please try to make your responses as simple as possible. I'm having issues with...
2
by: Vivek Sharma | last post by:
Hi There, I have a situation where I wish to load the controls dynamically on the basis of user role. Hence, I am using this code. if (UserRole == "IS Administrator") { Control UC1 =...
6
by: Shimon Sim | last post by:
Hi I am working on application that need to hold custom user information - Last and first name, email, some other domain related information. I used to create Base class for all my pages. The base...
4
by: Antuane | last post by:
i'm trying to create a custom textbox class, by simply creating a new class & inheriting from the textbox class. But i don't have a UI of this class. I.e., how can i set up the default text, color...
0
by: Joe | last post by:
Anyone have any experience using custom snaplines? I have a usercontrol that acts as a container for several child controls. I wrote an inherited ControlDesigner to handle some custom actions...
1
by: Veerle | last post by:
Hi, I use the infragistics tabcontrol on several pages of my application, that looks like this: <igtab:UltraWebTab ID="MyTabPage" runat="server"> <Tabs> <igtab:Tab Key="Tab1" Text="Title for...
2
by: forest demon | last post by:
i'm trying to create a custom control that contains multiple controls of different types(textbox, combox, checkbox, etc..) the examples i see derive from one type....for instance TextBox....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.