グループスタイルのリストビューがあり、エキスパンダー (以下のコード) を定義しています。適切なエキスパンダーに追加されるリストビューにプログラムで多くの項目を追加し、新しい項目に対してエキスパンダーが存在しない場合は動的に作成されます。
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" >
<Expander.Header>
<DockPanel>
<TextBlock FontWeight="Bold" Text="{Binding Path=Name}" Margin="5,0,0,0" Width="100"/>
</DockPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</ListView.GroupStyle>
したがって、必要なことは、新しいアイテムが追加されたときに、フォーカスをそのアイテムに向け、エキスパンダーを展開し、他のすべてを折りたたむことです...