Skip to content

Instantly share code, notes, and snippets.

@dkalamari
Last active September 27, 2023 13:46
Show Gist options
  • Save dkalamari/5712953 to your computer and use it in GitHub Desktop.
Save dkalamari/5712953 to your computer and use it in GitHub Desktop.
WPF Binding form close event to viewmodel command
<Window x:Class="App.WPF.Windows.DocumentDetailsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" WindowStartupLocation="CenterScreen"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
Title="Document Details" Height="700" Width="700">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Closing">
<i:InvokeCommandAction Command="{Binding CloseCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Window>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment