Good day,
First question here and just learning WPF, so please be gentle...
I'm trying to put together a TreeView whose items fire Commands. I'm sure there are many ways to accomplish this, but my approach has been to create a Style for the TreeViewItem with a ControlTemplate that incorporates a RadioButton for its Command functionality.
. . .
<ToggleButton x:Name="Expander"
Style="{StaticResource ExpandCollapseToggleStyle}" Grid.Column="0" Grid.Row="0"
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press"/>
<RadioButton Style="{StaticResource TreeElementStyle}"
Grid.Row="0" Grid.Column="1" Command="{TemplateBinding ???}">
<ContentPresenter x:Name="PART_Header" ContentSource="Header"/>
</RadioButton>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"/>
</Grid>
. . .
Regardless, I have tree visually looking fine but cannot fathom how to bind my Command to the incorporated RadioButton, and am lost in a quagmire of template confusion.
. . .
<TreeView>
<TreeViewItem Header="Enterprise">
<TreeViewItem Header="General Settings"
Command="{Binding Path=GeneralSettingsCommand}"/>
. . .
I would provide more code, but I assume at this point, answers will be more along the lines of, "Dude, you're way off track. Read about blah first", or "a Button is completely unnecessary", or "you should be using an ItemTemplate instead" or..." or "just give up already" ;)