I have a windows phone application and I need to add a user control to one of its pages. I want to add it like what in an asp.net page, not as a popup. How can I add this user control to the page?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming your UserControl is in the format of something like:
which it should by default when you create a new UserControl and the code behind is similar to
you should then be able to add it to the page by using code similar to
Just change the namespace after
clr-namespace:and the control name aftersrc:You can put the
xmlns:tag into the<phone:PhoneApplicationPage>tag instead to use the control throughout the form (rather than just in a grid) and you can change thesrcto whatever you wish to refer to it as.If the UserControl is created properly, compiling the solution should mean it appears in your Toolbox for use too, so you could then just drag & drop.
See the reference for a fuller example.