一、竖向布局
<ItemsControl ItemsSource="{Binding MenuList}" x:Name="itemsControl">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Margin="0" Command="{Binding DataContext.AddTabItemCommand,ElementName=frmWorkstation}" CommandParameter="{Binding Param}" Padding="0" BorderThickness="0" Height="80"
HorizontalContentAlignment="Center" BorderBrush="Transparent" Cursor="Hand" >
<StackPanel Height="80" Width="80" Orientation="Vertical">
<Image Margin="0,10,0,0" Width="40" Height="40" Source="{Binding Icons}"/>
<TextBlock Margin="0,10,0,10" FontSize="13" Text="{Binding Title}" HorizontalAlignment="Center"/>
</StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
二、横向布局
<ListBox ItemsSource="{Binding FileList}" x:Name="fjList" BorderThickness="0">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Button Margin="0" Foreground="Blue" Command="{Binding DataContext.FilePreviewCommand,ElementName=fjList}" CommandParameter="{Binding Fjid}" Padding="0"
HorizontalContentAlignment="Center" BorderBrush="Transparent" Cursor="Hand" Content="{Binding Wjm}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>