Click here to Skip to main content
15,891,880 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to add a user control to a canvas.
i tried this:

C#
usercontrol usrcntrl=new usercontrol();
canvas.childre.add(usrcntrl1);

but its not working;
Posted
Updated 31-Jul-13 2:00am
v3
Comments
[no name] 31-Jul-13 8:33am    
"its not working" is still neither helpful nor descriptive of any kind of a problem.
You code will not compile.
If you are really trying to add your usercontrol to a Grid then why is your code trying to add your usercontrol to a Canvas?
You really really really need to get a book on basic programming and work through it instead of trying to learn how to program one vague question at a time.

 
Share this answer
 
Not sure what your question ... but if you wish to set the top and left of "uc" ... then


Canvas.SetTop(uc,10)
Canvas.SetLeft(uc,10)
 
Share this answer
 
Comments
prapaug 31-Jul-13 8:26am    
i have a gird with me and i have a user control too.i want to add this user control to the grid in main window.i hope you got my question

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