Click here to Skip to main content
15,909,324 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want design a property for user control
which add to properties windows
Posted

If you what to add extra properties to an existing class, then see this link Properties (C# Programming Guide)[^]

C#
class TimePeriod
{
    private double seconds;

    // Property "Hours"
    public double Hours
    {
        get { return seconds / 3600; }
        set { seconds = value * 3600; }
    }
}
 
Share this answer
 
Good idea. Go ahead, you got my approval.

The property window only requires that you make your property public.
If you need to supply a special editor for your property, it is also possible, but is quite a difficult work. I will give you some references if you need it, but I would not advise it as this work needs considerable experience (and Microsoft design of this feature is far from perfect; and the documentation is not so clear).

—SA
 
Share this answer
 

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