0

I am showing dialog window when I double click on Grid row as below

this.ShowDialogWindow("Details", itemDetailView);

I have few textboxes and checkboxes on the Window. After I make few changes, if I click on 'X' on top of window, I want to update those fields in database.

How can I get dialog window 'X' in WPF MVVM ?

If it is not possible, I want to take away 'X' and place custom SAVE and CLOSE button in that place.

Apprecite inputs.

Chatra
  • 2,989
  • 7
  • 40
  • 73
  • [Window.Closing Event](http://msdn.microsoft.com/en-us/library/system.windows.window.closing%28v=vs.110%29.aspx) – icebat Nov 26 '14 at 14:18
  • @icebat Got it. Thanks. Here is the link http://stackoverflow.com/questions/15201122/handling-window-close-button-in-wpf-mvvm – Chatra Nov 26 '14 at 14:26

1 Answers1

0

if i would be a user i would expect that you dont save anything when i hit the "X" :)

but nevertheless if you call a DialogService in wpf then you just have to check the DialogResult

 var result = this.ShowDialogWindow("Details", itemDetailView);
Community
  • 1
  • 1
blindmeis
  • 22,175
  • 7
  • 55
  • 74
  • Hi, That is why I said, I want to replace that with SAVE and CLOSE button. Is there anyway to do that ? – Chatra Nov 26 '14 at 14:31
  • follow the link http://stackoverflow.com/questions/3801681/good-or-bad-practice-for-dialogs-in-wpf-with-mvvm. and just update DB when DialogResult is true – blindmeis Nov 26 '14 at 14:36