I have close button in the header of eac开发者_C百科h tab of TabControl. Tabs are created dynamically in code and a datatemplate (in which the close button was defined) is applied. Now I want close-buttons to be visible only when tab is active. Is it possible to bind button's visibility property to tabitem's activeness (probably IsSelected property)? How?
Have a look Kent's solution. There's also some sample code on his blog.
It would be easier to achieve if you put close button in TabHeader template instead of datatemplate.
The following seems to be a solution:
http://blog.thekieners.com/2010/09/08/relativesource-binding-with-findancestor-mode-in-silverlight/
精彩评论