1.2: default context menu in Silverlight 4

In GoSilverlight 1.1 for Silverlight 4 it was unnecessarily complicated to provide a default context menu for a Diagram. In version 1.2 you can now set Diagram.ContextMenuEnabled to true and define a context menu on your Diagram:

[code] . . .
. . .

  <go:Diagram . . .
        <input:MenuItem Header="some default command" Click="MenuItem_Click" />

Note that this property has no effect on context menus defined in your
node or link DataTemplates, which continue to work as you would expect.

The default value for this property is false to allow tools to receive and handle right-mouse clicks.

When this property is true, the Diagram.CurrentTool will not receive right mouse button events…

Silverlight 3 does not support right mouse button events at all.

here is something I wanted to share. if you are using MVVM Light (free MVVM solution) in your node panel, you can add the following to get the context menu items node data result into your diagram view model.

<DataTemplate x:Key="nodeTemplate">
<go:NodePanel x:Name="nodePanel" go:Node.Location="{Binding Data.Location, Mode=TwoWay}" >
<Controls:MenuItem x:Name="searchConnected" Header="Search Connected..." > <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding ElementName=myDiagram, Path=DataContext.SearchConnectedCommand}" CommandParameter="{Binding Data}" />
</i:Interaction.Triggers> </Controls:MenuItem>
And in your ViewModel:
public RelayCommand<LatNodeModel> SearchConnectedCommand { get; private set; }
in the ctor:
SearchConnectedCommand = new RelayCommand<LatNodeModel>(OnSearchConnected);
and the delegate:
private void OnSearchConnected(LatNodeModel node) { var model = node; }