Delete Confirmation in Demo6 for SL Video Series

Delete Confirmation in Demo6 for SL Video Series

Old forum URL: forums.lhotka.net/forums/t/7441.aspx


CyclingFoodmanPA posted on Tuesday, August 11, 2009

Hi all,

First of all, the Silverlight Video's are awesome and have taught me a lot.  Your books are great Rocky, but I really think the videos kick things up a couple of notches.  Anyway, on video #5 and Demo6, on the Edit dynamic categories option, there is a delete button on the grid.  How would you prompt the user for a confirmation to delete the object?  I never let anyone delete anything, even administrators, without a delete conformation.

Thank you in advance,
CyclingFoodmanPA

RockfordLhotka replied on Wednesday, August 12, 2009

That's a UI concern, which is to say that the presentation layer (in code-behind or a ViewModel or a Controller) needs to deal with this.

What that means in a practical sense, is that the button's Click event needs to trigger some code that pops up the confirmation dialog. That code can be in the code-behind, a ViewModel, a Controller, a Presenter or whereever is appropriate based on your presentation layer architecture).

In CSLA 3.8 I'm enhancing InvokeMethod so you can easily route the Click event to a method on any object, making this easier (hopefully).

In CSLA 3.6/3.7 you almost certainly have to write a Click event handler in code-behind, which can either do the work, or call another object that does the work.

OscarLauroba replied on Wednesday, May 04, 2011

Hi Rocky,

Would you please supply an example of how to do this with bxf and csla 4.1 for silverlight? I've been looking for a sample in csla 4.1 samples but I couldn't find anything similar. How does an EditViewModel know if another DeleteConfirmViewModel has been accepted or canceled?

Oscar.

RockfordLhotka replied on Wednesday, May 04, 2011

This thread in the Bxf forum might be useful to you

http://bxf.codeplex.com/discussions/239182

OscarLauroba replied on Thursday, May 05, 2011

Thank you Rocky. But I can't find any sample of delete confirmation or something similar. What's the name of the bxf sample you are talking about in the codeplex discussion? Is it UsingBxfNav.sln? In this sample, an errorWindow is shown, but the user doesn't make any decision between Yes or Not that the application had to consider later. Do you think it's better that I post my question in bxf codeplex forum?

RockfordLhotka replied on Thursday, May 05, 2011

This is a Bxf question, and so does belong in that forum, yes.

I was referring to UsingBxfNav. It doesn't show delete confirmation, but does show display of a dialog window. In some thread I also talk about having the original viewmodel maintain a reference to the viewmodel provided to the dialog, so when the dialog is closed, that dialog viewmodel will have the result, and therefore the original viewmodel can access the result. The original viewmodel typically has to listen for a PropertyChanged (or other) event on the dialog viewmodel so it knows when the dialog result is available.

Copyright (c) Marimer LLC