wpf 实现ItemsContro

        <ItemsControl ItemsSource="{Binding OtherInfoCollection}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal" Margin="10,10,0,0">
                        <Label Content="{Binding InfoType,Mode=OneWay}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="10,0,0,0"/>
                        <TextBox TextWrapping="Wrap" Margin="0" Text="{Binding InfoValue, Mode=OneWay}" VerticalAlignment="Center" Width="102" Height="25.837" HorizontalAlignment="Left" d:LayoutOverrides="HorizontalAlignment"/>
                    </StackPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

原文地址:https://www.cnblogs.com/swarb/p/9924365.html