『QQ:1353814576』

WPF实现ListBox实现多列自定义内容显示


WPF实现ListBox实现多列自定义列显示

上代码:ListBox多列自动换行的前端XAML实现代码 很简单

<ListBox MaxHeight="100" Name="ColourGamutList" 
	ItemsSource="{Binding}"  ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                                    <ListBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <WrapPanel />
                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>

                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <WrapPanel>
                                                <!--内容区域-->
                                                <Label Width="90" Content="自定义内容" />
                                  
                                            </WrapPanel>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
</ListBox>

下面这个TK精灵进程守护软件ui界面就是wpf基于以上代码实现的一个多列自适应卡片式排列效果

WPF实现ListBox实现多列自定义列显示