mvvm-light

Handling the window closing event with WPF / MVVM Light Toolkit

I'd like to handle the "Closing" event (when a user clicks the upper right 'X' button) of my window in order to eventually display a confirm message or/and cancel the closing. I know how to do this in the code-behind : subscribe to the "Closing" event of the window then use the "CancelEventArgs.Cancel" property. But I'm using MVVM so I...

Explorer ContextMenu Entry Problems

I'm using the MVVM Light Toolkit in my App. Though I don't know if my problem is related to it. I have added a ContextMenu Entry for the Windows Explorer on Win7 32bit. It looks like this: [HKEY_CLASSES_ROOT\*\shell\MyEntry] [HKEY_CLASSES_ROOT\*\shell\MyEntry\command] "MyPath+MyExe" "%1" Now if I open a file from the Folder where my...

Update Dependency Property prior to program exit

I have created a dependency property of type Binary on a RichTextBox which allows me to bind to a FlowDocument which is in binary form (byte[]) within the ViewModel. This works well, the property converts to and back correctly. Whenever the RichTextBox looses focus then the value of the dependency property is updated with the new binary...

MVVM Light Messenger executing multiple times

I am using MVVM Light and am using Messages to communicate between ViewModels to let a ViewModel know when it is ok to execute something. My problem is that I register for a message and then it receives it multiple times. so to keep from my program executing something more than once I have to create boolean flags to see if it has alrea...

What's the right pattern? An observer between the viewmodel & service

I am building a WP7 client app that talk to a web service (SOAP like) using Mvvm-Light. I have a ViewModel that both implements INotifyPropertyChanged and calls RaisePropertryChanged with the broadcast flag set. Both my view (XAML) and my model (which does HTTP requests to the web service) subscribe to property changes. XAML, obviou...

Drop Event Listbox

Hello, I am trying to add the contents of my textfile to listbox. Here is the code :- This is my MainPage.xaml :- <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/...

How can MVVM Light be used in a WPF User Control Library project?

Specifically, I would like to know how the view model is to be bound to a user control. The examples I have been able to find so far are all WPF Application or WPF Browser Application projects. Even the templates in tool kit are for WPF Application or WPF Browser Application projects. I am using Visual Studio 2010. ...

Using MVVM Light messaging instead of query strings in Windows Phone

Hi All, I am trying to use MVVM light messaging to send a value from one page to another during Navigation (for example, send the id of an item that was selected to an edit page). So the list page's viewmodel sends a message and then sends a navigation message to the view which redirects to the edit page. The edit page's viewmodel get...

RelayCommand CanExecute behavior not working

I'm having trouble getting the RelayCommand to enable/disable the attached control properly. I've got an EventToCommand element attached to a button. The command is databound to the ViewModel. Initially, the button is disabled (expected behavior), but I cannot seem to get the CanExecute logic to check it's value. When CurrentConfigFile...

How do I make Message targets be the only recipent of a targeted Message?

Hello Stack Overflow! First time poster. I'm using MVVM-Light with Silverlight 4 and RIA Services. This has been a learning experience! But so far, it's working beautifully. I was wondering two things. Right now, I'm using the Messenger framework to pass EntityObjects back to the ViewModel. For instance, I need to open a View Model wit...

MVVM Silverlight Framework Choices

Which Silverlight MVVM Frameworks should I look at - taking into account these areas of functionality. 1) IoC - can I choose my own? I would like to avoid using MEF w/ Attributes. 2) Navigation 3) Callback simplification 4) "IMessageBox" type abstractions 5) Testability 6) Logging Note: mitigating a conversion to full-blown WPF is n...

MVVM Light and windows phone RTW any gotchas

Are there any gotchas using mvvm-light and the RTW windows phone 7 tools? There was a hotfix back in July but is there a new one in the pipeline? ...

Using roles/permission to enable/disable content in the view

I'm working on an WPF application using the mvvm-light framework. I'm new to both of these. I have a form that allows a user to edit a record in a database. Admin users need to be able to update a field that should be read-only for other users. It would be easy for me to put this enable/disable code in the view's code-behind but my und...

Need comparison of MVVM / WPF / Silverlight Toolkits

I'm looking for a good article that compares MVVM Light, Caliburn Micro, Prism, and any other Silverlight / WPF / WP7 frameworks out there. I've seen some good articles on them individually, but nothing that really pits them against one another. Any suggestions? ...

MVVMLight and WP7 RTM

Does the MVVMLight version that worked before with the WP7 Beta work with WP7 RTM? ...

MVVM Light - how to fire command from code behind

Hello, I need to fire command from WP7 applicationbar. Unfortunately it is not possible, but Laurent published interesting workaround: private void ApplicationBarMenuItemClick(object sender, System.EventArgs e) { var vm = DataContext as MainViewModel; if (vm != null) vm.MyCommand.Execute(null); } Unfortunately my code behind ...

Communication between ViewModels

Hi! I have two questions regarding communication between ViewModels. I am developing a customer management program. I'm using Laurent Bugnion's MVVM Light framework. In the main page, there's a list of customers. when each customer is clicked, a child windows shows up with information about that customer. the user should be able to o...

How to trigger an EventToCommand from a GestureListener.Gesture

Has anyone used a Toolkit.GestureListener to fire an EventToCommand? ...

MVVMLight Toolkit, App.xaml, MergedDictionaries, global locator

Does anyone know how to use the ViewModelLocator in App.xaml, and also have MergedDictionary entries when using the MVVM Light Toolkit? I used the MVVM Light app template, and simply added a reference in App.xaml to my Styles.xaml, and am now getting the error below, but only when I include the entry for the view model locator. Here is...

Passing a Parameter to ViewModel constructor

Is it possible to pass a parameter to the ViewModel constructor? I would then use this parameter to initialise a property and/or do other operations in the ViewModel. With WinForms I could do public MyForm(MyParamType myParam) { MyFormProperty = myParam; //etc. } How do I go about doing something similar in the MVVM pattern ...