Create a ListView control that implements a GridView view with CheckBox controls for each row.
<Window x:Class="SDKSample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Window.Resources>
<XmlDataProvider x:Key="MyData" XPath="/Info">
<x:XData>
<Info xmlns="">
<Song Name="Song 1"/>
<Song Name="Song 2"/>
<Song Name="Song 3"/>
</Info>
</x:XData>
</XmlDataProvider>
<Style x:Key="MyContainer" TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Foreground" Value="Blue" />
<Setter Property="Cursor" Value="Hand"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true" />
<Condition Property="Selector.IsSelectionActive" Value="true" />
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="Yellow" />
</MultiTrigger>
</Style.Triggers>
</Style>
<DataTemplate x:Key="FirstCell">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=IsSelected,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"/>
</StackPanel>
</DataTemplate>
</Window.Resources>
<StackPanel>
<ListView ItemsSource="{Binding Source={StaticResource MyData}, XPath=Song}"
ItemContainerStyle="{StaticResource MyContainer}"
SelectionMode="Single"
Name="myPlaylist">
<ListView.View>
<GridView>
<GridViewColumn CellTemplate="{StaticResource FirstCell}" Width="30"/>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding XPath=@Name}" Width="80"/>
</GridView>
</ListView.View>
</ListView>
</StackPanel>
</Window>
Related examples in the same category