0
當我的展開父展開時,我試圖展開一個子節點。在父視圖展開時父展開的時候展開子代
除非另有說明:(Child.IsExpanded == Parent.IsExpanded)
這似乎是正確的,但似乎並沒有工作:
<TreeView ItemsSource="{Binding}">
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem">
<Style.Triggers>
<DataTrigger Value="True"
Binding="{Binding Path=IsExpanded,
RelativeSource={RelativeSource
Mode=FindAncestor,
AncestorType={x:Type TreeViewItem},
AncestorLevel=2}}">
<Setter Property="IsExpanded" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
無論是做這個的:
<TreeView ItemsSource="{Binding}">
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem">
<Setter Property="IsExpanded"
Value="{Binding Path=IsExpanded,
RelativeSource={RelativeSource
Mode=FindAncestor,
AncestorType={x:Type TreeViewItem},
AncestorLevel=2}}" />
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
這裏缺少什麼?
在此先感謝。
+1「我不知道」 –