Does Prism provide a mechanism for commands that close a window? - c#

I believe that I saw somewhere that Prism provides a WPF mechanism for implementing ICommand that closes a window. I've been looking over the documentation but it's overwhelming and I can't seem to pinpoint anything about this (if it even exists). Does Prism have MVVM helpers for closing, or even creating, windows via view model command binding?
I do see that you can do it a more "manual" way, without Prism, but Prism does provide helpers for other similar tasks.

No, Prism doesn't provide any helpers for closing a Window. This can be done with standard MVVM techniques, and there is nothing special needed to accomplish this..

Related

Embed Windows.Form in WPF application

I was wondering, is there a consequence to embed a Windows.Form element in a WPF application ?
I don't really know the difference between both architectures, but mixing them can have negative impacts ?
There are always consequences with such choices.
Mainly winform doesn't support wpf event mechanism for bubbling event and dependency properties, you have to wrap it up if you want to use some binding and follow the MVVM pattern.
Besides, it will not be a part of the visual tree if I remember well. It will create an other form over the form of your application, i.e. an other window handle...
Not impossible, but You got to wondering yourself If it is worth it.

No target found for method thrown by Caliburn

I'm trying to create an application which allows me to sketch some doodles on the canvas component with the help of Caliburn.Micro for MVVM. When I run the application and click on the Canvas I get "No target found for method OnMouseDown." exception. I defined the method to be called when the MouseDown event is called, but somehow Caliburn doesn't find it.
The project files are available here: SketchingTool.zip
Apparently I wired the application in a wrong way. The ViewModel it was looking for for methods was not the ViewModel they were in, because I mixed the view-first approach with the viewmodel-first approach. Fixing it according to the documentation of Caliburn fixed the problem.

convert mdi application to mvvm wpf application

I have a winform application that I want to convert to WPF
It has a main form (MDI) and the children can call each other as well.
I read that MDI is not a good practice according to the mvvm. But I saw that application have the look and feel that I want (e.g:Prism- I was told that it is too complicated for beginners and for a small application like I need).
Do you know a small WPF project that follow the mvvm rules and has the look and feel of MDI application?
Thanks
Asaf
MDI is a GUI design pattern. MVVM is a programming design pattern. The two really aren't related at all. You can do either one or both together.
It is true, however, that many GUI design experts frown upon MDI but that's entirely because of usability for the end-user... not because of the underlying code.
Perhaps if you describe or provide a mockup of the UI you want to create we can provide guidance on how to implement it in WPF.

General WPF Application

Am just creating myself a WPF application, like outlook. am having all forms seperately. I just want one main window and and am haivng navigation pane in left side. when ever i click items in pane, i just want to load corresponding form to the main window in right container. How i can do this?
Use a design pattern like MVP or MVVM..
Also you probably want to use the Command pattern which will benefit the maintainability of your UI related commands.
Tutorials:
WPF Patterns
This tutorial should get you started with these patterns. Paul Stovell shows how to implement MVP and MVVM and displays strenghts and weaknesses of each pattern.
OutlookBar:
This link should get you started with the UI part of your challenge. It shows how to use such a control and implement the Command pattern.
HTH

how to execute events in mvvm pattern for silverlight

Can anyone provide a short example of how to execute an event within the mvvm pattern for silverlight? In reading I have seen references to where silverlight does not support commanding? If that is the case how then what is the most common practice to initate methods in the mvvm pattern? Is a third party framework need or can this be accomplished using routed events? A simple example would be great... say a button wihtin the xaml and then within a viewmodel class the method to open an alert window of change the text of a textblock? I'd appreciate any insight as to what the most common approach is for initiating an event( mouse click events etc) and how these methods could be called.
thanks in advance
Though there isn't an implementation on Silverlight, the ICommand interface is present in the framework. You should take a look at the DelegateCommand class in Prism.

Categories