I have a WPF window, datacontext is instantiated usin XAML
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ViewModels="clr-namespace:Contratos.ViewModels" x:Class="Contratos.Views.TipoAsociadoAcopio"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF45"
xmlns:l="clr-namespace:Recursos;assembly=Recursos"
xmlns:controls="clr-namespace:Recursos.Controls;assembly=Recursos"
xmlns:resources="clr-namespace:ModelSeguridad.Resources;assembly=ModelSeguridad"
Title="{x:Static resources:Labels.CONTRATO_TipoContratoAcopio}" Height="Auto" Width="Auto">
<Window.Resources>
<CollectionViewSource x:Key="ListaItems" Source="{Binding ListaItems}"/>
<ViewModels:TipoAsociadoVM x:Key="ViewDataContext"/>
</Window.Resources>
<Grid>
<StackPanel>
<Button Command="{Binding _ICommandExit}" CommandParameter="{W H A T H E R E}" />
</StackPanel>
</Grid>
I need to close this window when the user click on Exit Button, My question is How can I do to send the Window reference to viewmodel if it was instantiated using XAML.
I'm trying to maintain MVVM pattern, thats because I don't have any code on mi codebehind.