When user clicks on X, I want to check whether there are any unsaved changes in the page. I have isSaved Property which tells me that.
Now, if there are any unsaved changes, I want to show Alert window(which is in place) to confirm by user to close pane or not.
If user says Yes, I want to close. If not I dont want to close.
How can I implement this in MVVM ? I understand PreviewClose in triggering first. If there are unsaved changes, How can I stop closing the pane ?
Here are my interaction trigger.
<i:Interaction.Triggers>
<i:EventTrigger EventName="PreviewClose">
<cmd:EventToCommand Command="{Binding PreviewCloseCommand}" CommandParameter="{Binding ElementName=ContentContainer}" />
</i:EventTrigger>
<i:EventTrigger EventName="Close">
<cmd:EventToCommand Command="{Binding CloseCommand}" CommandParameter="{Binding ElementName=ContentContainer}" />
</i:EventTrigger>
</i:Interaction.Triggers>