Override element method in XAML UserControl?

I have a Silverlight custom control that doesn't have a template and doesn't need one as it is just a path using a RectangleGeometry that is resized by code. Now our design has added a template to the path hint, and I want a way for me to give the user the ability to change the layout of a portion of that template. If the template was part of a shared control, I could simply override the control's OnApplyTemplate method and get a link to the section that I want to change. But because the control has no template, the overridden method in the control code is not called.

Is there a way to override the OnApplyTemplate method for a templated element in control code?

0


source to share


1 answer


What is a base class. You cannot override OnApplyTemplate if the base class does not support templates. I think your best bet is to change the style of the tooltip when the value is set (as this is unlikely to appear anyway).



For some reason, you can't just use GetTemplateChild as the path changes? It should be late enough throughout your life.

+1


source







All Articles