INotifyPropertyChanged で bool IsExpanded プロパティにバインドされたエキスパンダーを使用する listboxitem のグループ ヘッダー テンプレートがあります。Interaction Trigger が追加され、リストボックス内のすべてのリストボックス項目を一度に展開および折りたたむことができるようになりました。
私の問題は、コントロールが開いたときにグループヘッダーをデフォルトで展開することです(現在はそうではありません)。設定でこれが達成されると思い<Expander IsExpanded="True">
ましたが、表示には影響がないようです。何かご意見は?以下の完全なコード スニペット。
<Expander IsExpanded="True">
<i:Interaction.Triggers>
<ei:PropertyChangedTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}}, Path=DataContext.IsExpanded, Mode=TwoWay}">
<ei:ChangePropertyAction PropertyName="IsExpanded" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}}, Path=DataContext.IsExpanded, Mode=TwoWay}"/>
</ei:PropertyChangedTrigger>
</i:Interaction.Triggers>
<Expander.Header>
<TextBlock Margin="5,0,0,0"
FontSize="16"
FontWeight="Bold">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} ({1})">
<Binding Path="Name"/>
<Binding Path="ItemCount"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Expander.Header>
<Expander.Content>
<ItemsPresenter/>
</Expander.Content>
</Expander>