<Interact:Interaction.Triggers>
<Interact:EventTrigger EventName="Closed">
<cmd:InvokeCommandAction Command="{Binding OnCloseWindowCommand}" />
</Interact:EventTrigger>
</Interact:Interaction.Triggers>
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:WpfApplication1"
Title="Window1" Height="193" Width="190">
<Window.DataContext>
<vm:Window1ViewModel />
</Window.DataContext>
<Grid>
<Button Content="Button" Height="33" HorizontalAlignment="Left" Margin="34,20,0,0" Name="button1" VerticalAlignment="Top" Width="109"
Command="{Binding ButtonCommand}"
CommandParameter="20"/>
<Button Content="Button" Height="33" HorizontalAlignment="Left" Margin="34,85,0,0" Name="button2" VerticalAlignment="Top" Width="109"
Command="{Binding ButtonCommand2}"
CommandParameter="{Binding RelativeSource={x:Static RelativeSource.Self}}"/>
</Grid>
</Window>
<i:EventTrigger EventName="SizeChanged">
<i:InvokeCommandAction Command="{Binding WindowSizeChangedCommand}" CommandParameter="{Binding ElementName=listView, Path=ActualWidth}"/>
</i:EventTrigger>
public RelayCommand WindowSizeChangedCommand
{
get
{
if (WindowSizeChangedCommand == null)
WindowSizeChangedCommand = new RelayCommand(param => WidowSizeChanged(param));
return WindowSizeChangedCommand;
}
}
public void WindowSizeChanged(object param)
{
int width = Convert.ToInt32(param);
}
https://prismlibrary.com/docs/wpf/interactivity/event-to-command.html