是这样的,需要一个ListBox来展示照片,并添加一个选中的CheckBox.这就需要对ListBox的ItemTemplate的DataTemplate进行定制.添加一个Image和一个CheckBox.
大概是这样子的.
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<Grid Width="250">
<Grid.RowDefinitions>
<RowDefinition Height="200"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
</Grid.RowDefinitions>
<Image Grid.Row="0" Source="{Binding Photo}" Width="220"/>
<CheckBox Grid.Row="1" Content="命中" IsChecked="{Binding IsTarget}"></CheckBox>
</Grid>
</DataTemplate>