wpf - Child window in MVVM light -


how can use messaging mvvm light in wpf app showing childwindow , returning values ? need present user modal dialog 2 datepickers , message return somehow theese 2 values using parameters other views. possible ?

usually use popup this.

the popup has visibility bound ispopupvisible property in viewmodel, , popup datacontext part of viewmodel

i'm not huge fan of wpf's default popup control, have own custom popup control here if you're interested.

it's typically used this:

<local:popuppanel content="{binding popupcontent}"     local:popuppanel.popupparent="{binding elementname=parentpanel}"     local:popuppanel.ispopupvisible="{binding ispopupvisible}" /> 

and show viewmodel this:

popupcontent = new selectdatesviewmodel(); ispopupvisible = true; 

once selectdatesviewmodel.savecommand gets triggered, can fire off message containing selected dates whatever viewmodels interested:

messenger.default.send(new dateschangedmessage(this.date1, this.date2)) 

the actual popup content can either defined in xaml, or implicit datatemplate

<datatemplate datatype="{x:type local:selectdatesviewmodel}">     <local:selectdatesview /> </datatemplate> 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -