Hi, Just define two
HierarchicalDataTemplate with
DataType. One is for the Child having CheckBox Control, and Other one is for the Child having RadioButton. Like,
For CheckBox Child Item,
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:CheckBoxChild}" >
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImgPath}" VerticalAlignment="Center" Margin="2" />
<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" VerticalAlignment="Center" Margin="2" />
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" Margin="2" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
For RadioButton Child Item,
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:RadioButtonChild}" >
<StackPanel Orientation="Horizontal">
<Image Source="{Binding ImgPath}" VerticalAlignment="Center" Margin="2" />
<RadioButton GroupName="Selection" Name="{Binding Option1Name}" IsChecked="{Binding IsOption1Checked, Mode=TwoWay}" VerticalAlignment="Center" Margin="2" />
<RadioButton GroupName="Selection" Name="{Binding Option2Name}" IsChecked="{Binding IsOption2Checked, Mode=TwoWay}" VerticalAlignment="Center" Margin="2" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
Here
local refers your application's namespace.
And, Just define two classes for CheckBox Child Item and RadioButton ChildItem, then based on these classes you can create objects and you can add those objects to your treeview like,
YourTreeView.Items.Add(RadioButtonChildObject);
YourTreeView.Items.Add(CheckBoxChildObject);