Hello,
I have a method OnClose which gets called on press of ShortCut key and i want the same method to get called on Close of Window from the Window X button. Below has been done for implementing ShortCut key:
<CommandBinding Command="cbase:UIShortCutsHelper.AltCCommand" Executed="OnClose"></CommandBinding>
and in code-behind, OnClose method has been written as below:
private void OnClose(object sender, ExecutedRoutedEventArgs e) { }
Now i want to call the same method using DelegateCommand on close of Window. Below is what I am doing in xaml at UserControl level:
<Interact:Interaction.Triggers><Interact:EventTrigger EventName="Closed"><cbase:ExecuteCommandAction Command="{Binding OnCloseWindowCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=EventArgument}" /></Interact:EventTrigger></Interact:Interaction.Triggers>
In Code-behind I have declared an ICommand property as below:
public ICommand OnCloseWindowCommand { get; set; }
and now i want to intialize the above command in Constructor:
//Need to pass the object and ExecutedRoutedEventArgs below OnCloseWindowCommand = new DelegateCommand(OnClose());
How can i pass the object and eventargs in above command?
Thanks,
Abdi