+1  A: 

You can handle the button click event in the code behind. To get to the data, just bind it to the Tag attribute.

<Button Margin="0" Grid.Column="2" 
        Click="Button_Click" Tag="{Binding}"
        Style="{StaticResource     TreeViewItemButtonStyle}">            
  <Image Source="../Assets/add.png" Margin="0" 
         HorizontalAlignment="Center" VerticalAlignment="Center"/>        
</Button>

In the code behind, handle it and access the element.

private void Button_Click(object sender, RoutedEventArgs e)
{
   var data = ((Button)sender).Tag as SimpleTreeNode
}

Where SimpleTreeNode is the name of your tree element class.

You should be able to add a new node to the data found now.

Sorskoot
Thank you for your reply :)It confirmed what I suspected; if I have the hierarchical data template in my Page.xaml, it works.Is there any way to bind an event to the button if the template resides in a resource dictionary (means, in a quite different file)?(If it was aggregated in the App.xaml via <ResourceDictionary.MergedDictionaries/>, would I have to place the EventHandler in the App.xaml.cs (or appropiate codebehind file)?)
ClearsTheScreen
+2  A: 

You can attach a Behavior to the Button in the HierarchicalDataTemplate and let that handle Click events from the Button.

Download and install the Expression Blend 3 SDK. Add a reference to System.Windows.Interactivity in the project and add a Behavior attached to a Button:

public class ButtonClickBehavior : Behavior<Button> {

  protected override void OnAttached() {
    base.OnAttached();
    AssociatedObject.Click += ButtonClick;
  }

  protected override void OnDetaching() {
    base.OnDetaching();
    AssociatedObject.Click -= ButtonClick;
  }

  void ButtonClick(object sender, RoutedEventArgs e) {
    Node node = AssociatedObject.DataContext as Node;
    if (node != null) {
      // Button clicked. Do something to associated node.
    }
  }

}

Attach the Behavior to the Button in the HierarchicalDataTemplate (assuming this namespace declaration: xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"):

<Button Margin="0" Grid.Column="2" Style="{StaticResource TreeViewItemButtonStyle}">
  <Image Source="../Assets/add.png" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  <interactivity:Interaction.Behaviors>
    <local:ButtonClickBehavior/>
  </interactivity:Interaction.Behaviors>
</Button>

If desired you can add properties to ButtonClickBehavior and set those from XAML to create a more reusable Behavior.

Martin Liversage
Awesome. Thank you for your help!I knew microsoft would have been thorough and had a way to do what I try to. ;)
ClearsTheScreen