I’m writing a custom control whereby it requires a specific parent for it to work.
In this case, its the Canvas panel. however where do i put the code to check that when it adds to the logical/visual tree, it throws a NotSupportedException?
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.
Override the OnApplyTemplate method in your custom control.
If you need a specific parent to work, I would advice creating a custom items control with a specific item container control and a specific items panel instead of forcing this behavior through an exception.