Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want create property for my custom control.

The property should have sub property like Margin property

My input will be like FullName="FirstName, LastName, MiddleName"

FullName name = new Names(FirstName, LastName, MiddleName);

Anyone give the Idea for this.

Thanks in advance
Posted

1 solution

1. Implement a class Name
2. The class should have properties FirstName, MiddleName, LastName which returns strings.
3. Add a property for the custom control which returns a Name.
4. Then you can access like customControl.Name.FirstName.
 
Share this answer
 
Comments
Sugavaneswara 8-Jun-12 7:27am    
i need give the input from xaml. Is it possible in this way?
krumia 8-Jun-12 7:30am    
Yes!
Sugavaneswara 8-Jun-12 7:48am    
Is it browsable from property window like Margin Property?
krumia 8-Jun-12 7:51am    
I think it should be, if you set [Browsable(true)] in the child properties too.
Sugavaneswara 8-Jun-12 8:38am    
Thanks you

Yes, It can. But I can't set the value from parent property. I need you set child property and then i have to set values.

But In margin property i can set values directly like margin="1,2,3,4"

Otherwise Is there any idea to give input like?

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