views:

67

answers:

1

I have a Silverlight user control that has no template and does not need one as it is simply a path with a RectangleGeometry that is resized by code. Now our designed has added a template to the tooltip of the path and I want to be able to provide a method for users of the control to change the layout of a portion of this template. If the template was part of an overall one for the control I could simply override the control's OnApplyTemplate method and grab a reference to the section I want to modify. But as the control has no template the overridden method in the control's code-behind is never called.

Is there some way I can override the OnApplyTemplate method for the templated element in the control's code behind?

+1  A: 

What is the base-class. You can't override OnApplyTemplate if the underlying class doesn't support templates. I think you'd be best to just change the tooltip style when the value is set (as its unlikely to show up anyway).

Any reason you can't just do GetTemplateChild as the path changes? That should be late enough in the lifetime.

Shawn Wildermuth
It's a path. I've posted a rewording of this question, along with some of the code <a href="http://stackoverflow.com/questions/1502411/how-to-modify-silverlight-template-at-runtime">here</a>
Steve Crane