3
我需要在下面的列表框中顯示。方案是它將有多個組,後面是水平對齊的項目。WPF Listbox分組
GroupA
GroupA Description
GroupB
GroupB Description
Items Available
ItemA ItemB ITemC
我需要在下面的列表框中顯示。方案是它將有多個組,後面是水平對齊的項目。WPF Listbox分組
GroupA
GroupA Description
GroupB
GroupB Description
Items Available
ItemA ItemB ITemC
您可以使用此代碼嘗試
<Style x:Key="ContainerStyle" TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Expander Header="{Binding ....}" IsExpanded="True">
<ItemsPresenter />
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ListBox x:Name="lbPersonList" Margin="19,17,162,25" AlternationCount="2">
<ListBox.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource ContainerStyle}"/>
</ListBox.GroupStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ...}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
諾塔:調整你的代碼的結合