Public Class SetUpV

   Private m_SetUpVM As SetUpVM

#Region "EVENTS"

   Private Sub Me_DataContextChanged(sender As Object, e As DependencyPropertyChangedEventArgs) Handles Me.DataContextChanged
      ' Assegno al riferimento locale al VM il VM preso dal DataContext
      m_SetUpVM = DirectCast(e.NewValue, SetUpVM)
   End Sub

   ' Evento di click di un Item dell'albero
   Public Sub TreeViewItem_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs)
      Dim TreeViewItem As TreeViewItem = DirectCast(e.Source, TreeViewItem)
      If TypeOf TreeViewItem.DataContext Is ToolItem Then
         Dim ToolItem As ToolItem = DirectCast(TreeViewItem.DataContext, ToolItem)
         m_SetUpVM.ToolDoubleClick(ToolItem)
         e.Handled = True
      End If
   End Sub

#End Region    ' EVENTS

End Class
