开发者

WPF ToolTip ControlTemplate access defining element properties

I am restyling the default tooltip by creating an Application level typed style resource which applies to every tooltips. In the tooltip ControlTemplate, I need to access (Binding to) a property value from the element which defines the actual tooltip. The defining element can be of any type. Binding RelativeSource FindAncestor works only for the specified AncestorType, not any other unspecified types. So my questions are, Can the AncestorType set to Any, or not applicable, but use AncestorLevel only? Is there other way for the controlTemplate to access the tooltip defining element's properties?

Any thought开发者_如何转开发 is appreciated.

Thanks,

Q


I find the following solution works.

{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Popup}, 
         Path=PlacementTarget.TheDesiredPropertyNameHere}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜