Could you help me? I need a TreeView with a CheckBox at every item. I can't get it, I started like this, and seems like absolutely wrong way:
<TreeView Grid.Row="0" Grid.Column="0" Name="StagesTreeView" Margin="5">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<!-- <Setter Property="?????"> WHAT SHOULD BE HERE?
<Setter.Value>
</Setter.Value>
</Setter> -->
</Style>
</TreeView.Resources>
</TreeView>
Show me pls. some simple example
UPD: Oh... I think I need a ControlTemplate, but I still dunno how to make it
UPD2: Gosh, as much I'm deepening into this I'm getting bewildered. Should I use RelativeSource markup extension somewhere here? Someone help me!
UPD3: Now it doesn't work like a TreeBox - I can't expand\collapse items, although I slightly moved forward - I can see the checkboxes.
<TreeView Grid.Row="0" Grid.Column="0" Name="StagesTreeView" Margin="5">
<TreeView.Resources>
<Style x:Key="{x:Type TreeViewItem}" TargetType="TreeViewItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid Margin="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=IsActive}"/>
<TextBlock Text="{Binding Path=Alias.UserName}"/>
</StackPanel>
<ItemsPresenter Grid.Row="1"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TreeView.Resources>
</TreeView>