0

I would like your opinion on how to design a custom dialog following the Prism framework with 2 views.

So, the idea is: When the user double clicks an item (Contact item) a popup view is displayed (this is the "Read only" view) where the user can read the contact details but cannot edit all of them (only a few properties of the contact can be edited). In this form, there is a button that switches to the "Edit" mode and then a "Edit" view is displayed in the same popup window (I don´t want to open a new window).

In the edit view, there are two buttons (one for save changes and one to cancel interaction). After saving or cancelling, the "Read only" view is displayed again.

Have you ever done this?

chincheta73
  • 187
  • 1
  • 22

2 Answers2

1

If the layout of the two views is the same, except for buttons that appear only in the "edit" mode, then I would opt for implementing one single view and use one property of the view model with appropriate converters to enable/disable edition in all controls and visibility of "edit mode" buttons at once. This way, you ease maintenance, evolution, testing by having one single view. The property would be triggered by the "make editable" button.

  • I don´t like this option 100% cause I want to display the elements differently plus there are some elements that appear in the read only view but they don't in the edit view. I would like to have two different views – chincheta73 Dec 04 '16 at 16:54
0

If the two views are really necessary, then I would go for a TabControl with hidden tabs, one containing the read-only view, the other containing the read/write view. The edit/done button(s), either one inside each view or one below the TabControl, would control the tab to be displayed. Then the ViewModel would be assigned to the TabControl, and by inheritance, both views would be bound to the same, making all modifications on one side automatically visible on the other (when displayed).

See here for hiding the tabs.

Community
  • 1
  • 1