Public Class OptionWindowV Private m_OptionWindowVM As OptionWindowVM Sub New(Owner As Window, OptionWindowVM As OptionWindowVM) MyBase.New(Owner) ' This call is required by the designer. InitializeComponent() Me.DataContext = OptionWindowVM ' Assegno al riferimento locale al VM il VM preso dal DataContext m_OptionWindowVM = OptionWindowVM End Sub Private Sub Me_Closing(sender As Object, e As EventArgs) Handles Me.Closing m_OptionWindowVM.CloseOptionWindow() End Sub End Class