How do I check for when my control obtains or changes the visual parent?
开发者_C百科I want to hook my control's visual parent's events.
You can override the OnVisualParentChanged()
method to be notified when ever your visual parent changes.
Note that it is almost always a bad idea to actually use this: In 99% of cases the data template should take care of hooking up related controls by setting their properties, or it is better handled with attached inherited properties. But for the other 1% there is OnVisualParentChanged()
.
精彩评论