The best way to do this is to create a custom model for your treeview item. In this model you will have all of your properties including your ICommand properties such as add new node, remove node so on so forth. For example, your model will have
private ICommand _RemoveNodeCommand;
public ICommand RemoveNodeCommand
{
get
{
if (_RemoveNodeCommand == null)
{
_RemoveNodeCommand=new ExecutePath(param=>this.RemoveNodeOperation(this);
}
return _RemoveNodeCommand;
}
}
public void RemoveNodeOperation(YourModelName node)
{
}
In your xaml since your itemsource will be of this type, the bindings for your event such as a context menu, or a mouse button click, which you can still do pure mvvm using System.Windows.Interactivity, then you can bind the command to this function.
For my remove logic I set up a delegate/event system to notify the itemssource in the viewmodel of the node removal since the itemsource property is in the viewmodel. I suppose you could also just add a bool IsSelected property to your model, and put the command logic in the viewmodel and do a search through the itemssource to see which is selected and remove it that way as well.