OK, so I am defining an ItemTemplate for the ListBox in the ResourceDictionary (Styles.xaml). The ListBoxItem template looks something like this:
<ControlTemplate TargetType="ListBoxItem">
<Button Command="{Binding Path=DoSomeCommand}" Content="Test" />
</ControlTemplate>
Now that this template is in use, I would like this button to click the snap button to the available ViewModel command to process it.
However, this does not work as it is, I also tried this:
<ControlTemplate TargetType="ListBoxItem">
<Button Command="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DoSomeCommand}" Content="Test" />
</ControlTemplate>
But still no dice.
A simple example that works if you define a template in the control (resources) that uses it and just use an event handler (the same handler for all generated XAMLs.
? , : , ListBox.
!