2009-11-24 21 views
0

我使用的後代一個在我的應用程序的幾個地方作爲一個ItemsControlContentControl並在ToolTipDataTemplate(一StaticResource)。Expander.IsExpaned只有當前模板是一個工具提示

該模板包含一個Expander,並且如果DataTemplate位於ToolTip內,我希望它的IsExpanded屬性爲true。

有什麼建議嗎?

回答

0

此檢查父提示,如果沒有家長提示,將進行評估,以什麼=假:

<Expander Name="expJobContacts" 
    IsExpanded="{Binding IsVisible, 
     RelativeSource={RelativeSource Mode=FindAncestor, 
      AncestorType={x:Type ToolTip}}, 
     Mode=OneTime}" /> 

我測試和它的作品。