Question

I am currently working on a project that is using PRISM 4 + MVVM in a WPF 4 application.
I have been reading up on InteractionRequest and there seems to be little information on how to implement it so that the dialog is a stylable user control and has textbox and other controls in it.
All the samples I find are just dialog windows with text in them.

What I am looking to do is have a listview that when a user selects an item it opens a dialog box where they can edit the details and either save or cancel.

Is this the correct approach with WPF? Should I be doing something other than InteractionRequest?
I generally do web applications so WPF is a bit new to me.

Any assistance would be greatly appreciated.

Thanks!

Was it helpful?

Solution

i simply use a dialog service for this kind of work.

in your viewmodel you just have to call

  var result = this.uiDialogService.ShowDialog("Dialogwindow title goes here, eg Edit Details", detailViewmodel);

thats all :)

EDIT:

you can style your UserControl like you want

<DataTemplate DataType="{x:Type local:DetailViewModel}" >
    <view:DetailsView/>
</DataTemplate>

OTHER TIPS

I'm using both a dialog service and interaction requests.

A dialog service is better for common dialogs that must be displayed throughout your application which have the same look and feel. For example, OpenFileDialog, Color Choosers, Printing, Error Messages, etc.

Interaction requests can be better for simple user interactions which are specific to a certain view. For example, let's pretend that a view has a button which is bound to a command in the view model. That command allows the user to pick between options A,B,C and then performs some function with that choice. The ViewModel may start an InteractionRequest that it wants the user to pick from A,B,C. The View can handle that event and provide a simple template which describes how to display those options A,B,C to the user. Therefore you maintain separation of UI & business logic. In this case, it seems better to implement this custom interaction from within the View code because it is simple and specific to this view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top