WPF数据绑定(ItemTemplate和DataTemplate)

<ListBox Name="lb_fileInfo" Grid.Row="1" Grid.ColumnSpan="3" ItemsSource="{Binding}" SelectionMode="Single" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> 

<ListBox.ItemsPanel> 
<ItemsPanelTemplate> 
<WrapPanel IsItemsHost="True" /> 
</ItemsPanelTemplate> 
</ListBox.ItemsPanel> 
<ListBox.ItemTemplate> 
<DataTemplate> 
<Border Margin="3" BorderThickness="1" BorderBrush="SteelBlue" CornerRadius="2"> 
<StackPanel Margin="3"> 
<!--<StackPanel.ToolTip> 
<Image Margin ="3" HorizontalAlignment="Center" Source="{Binding Path=bigThumbNail}" Stretch="None"></Image>

</StackPanel.ToolTip>--> 
<Image Margin ="3" HorizontalAlignment="Center" Source="{Binding Path=thumbNail}" Stretch="None"></Image>

<TextBlock FontWeight="Bold" HorizontalAlignment ="Center" Margin ="3" Text="{Binding Path=name}"></TextBlock>

<ProgressBar Height="10" Name="progressBar1" Width="200" /> 
<TextBlock FontStyle="Italic" HorizontalAlignment="Center" FontSize="10" Margin ="3" Text="{Binding Path=revitType}"></TextBlock>

</StackPanel> 
</Border> 
</DataTemplate> 
</ListBox.ItemTemplate> 
</ListBox>

原文地址:https://www.cnblogs.com/lipf/p/2473853.html