mvvm-light

MVVM-Light: The target "RunCodeAnalysis" does not exist in the project when i do build??

Hi there, Just built myself a mvvmlight app and if i press f5 TO COMPILE and run all works ok, it displays the wpf window but if i do a BUILD i get an error Error 1 The target "RunCodeAnalysis" does not exist in the project. I am using the visual studio 2010 professional version RTM The only thing i see strange is the target ...

SelectionChanged event binding in Silverlight+MVVM-Light

The handler of the "SelectionChanged" event of the ComboBox control has the following signature: void SelectionChangedMethod(object sender, SelectionChangedEventArgs e) How to bind to that property under Silverlight 4 and MVVM-Light to the corresponding method of the ViewModel object? As far as I know, I need to do something like thi...

Send a empty Message or Notification with MVVM toolkit light

I'm using the MVVM Light Toolkit. I could not find any Ctor of Messenger or Notification class to send a empty message. ViewModel1: private int _selectedWeeklyRotation; public int SelectedWeeklyRotation { get { return _selectedWeeklyRotation; } set { if(_selectedWeeklyRotation == value) ...

How to play Sound and Animations in MVVM

I have read alot of blogs about the best way to play sound/Animation but if possible I would like to see a simplified example on how this is done so I understand better. So to my understanding in MVVM The View-->Sound and Animation The ViewModel-->If some value is true, i would like to play the Sound and Animation on the view. Now Ho...

VS 2010: Can’t insert mvvm-light snippet using shortcut - incompatibility with resharper 5???

Hi there, i recently installed some snippets that come with the mvvm-light framework i am using. And sure enought i checked via Tools > Code Snippet Manager and they are installed under "My Code Snippets". If i do insert Snipper (right click in code window) or CTRL K + CTRL X then i can search within all available snippets.... ...

mvvm-light: Should we merge Cleanup methods in locator?

Hi there, when creating a new ViewModel within the locator class using the snippet it creates a Cleanup Method but there is already one available from the Main so hence an error.... Should we merge them all?? Or should we be renaming the method to Cleanup[Name of viewmodel] for example. I am a little confused here Another question i...

Cleanup vs Dispose(bool) in MVVM-light

In the lastest version of MVVM-light (V3 SP1) both "Dispose()" and "Dipose(bool)" methods in ViewModel class are marked Do not use this method anymore, it will be removed in a future version. Use ICleanup.Cleanup() instead Does this mean that IDisposable interface must not be implemented in all ViewModel classes that are derived f...

Passing event args and sender to the RelayCommand

How do you get event sender when using RelayCommand? ...

Error handling for AutoCompleteBox with Silverlight 3 + MVVM Light toolkit

Hi, I'm trying to create a UserControl that contains a AutoCompleteBox. I want to use the SelectedItem property of this AutoCompleteBox to populate other UserControls with information based on which item the User selected. To prevent the SelectedItem to be fired every time a user "navigate" between items in the drop-down I've created a ...

Receive messages for derived types in MVVMLight

Shouldn't this test pass: [TestMethod] public void derived_message_subscription() { bool handled = false; Messenger.Default.Register<GenericMessage<baseClass>>(this, true, (msg) => handled = true); Messenger.Default.Send(new GenericMessage<testClass>(new testClass())); Assert.IsTrue(handled); } public abstract class bas...

WPF ComboBox Binding to non string object

I'm using MVVM (MVVM Light Toolkit) and have a property on the view model which exposes a list of objects. The objects contain two properties, both strings, which correlate to an abbreviation and a description. I want the ComboBox to expose the pairing as "abbreviation - description". If I use a data template, it does this easily. I ...

Can't pass a single parameter to lambda function in MVVM Light Toolkit's RelayCommand

I don't know if there's a difference between Josh Smith's and Laurent Bugnion's implementations of RelayCommand or not, but everywhere I've looked, it sounds like the Execute portion of RelayCommand can take 0 or 1 parameters. I've only been able to get it to work with 0. When I try something like: public class Test { public Relay...

how to parametrize an import in a View?

Hello everybody, I am looking for some help and I hope that some good soul out there will be able to give me a hint :) I am building a new application by using MVVM Light. In this application, when a View is created, it instantiates the corresponding ViewModel by using the MEF import. Here is some code: public partial class ContractE...

Silverlight dataform MVVM command binding on update.

I'm new to MVVM and Silverlight and I'm just trying to figure out a simple scenario. I'm using the MVVM Light toolkit and Silverlight 3.0 without Expression Blend. I have a DataGrid and a DataForm bound to an observable collection in a ViewModel. I would like to bind to my RelayCommand Save() property after I make changes to the data i...

Can the MVVM-Light ViewModelLocator be used in nested ViewModels?

The Visual Studio 2008 Designer doesn't seem to like UserControls that reference the MVVM-Light ViewModelLocator. I get an error message like: Could not create an instance of type 'MyUserControl'. For example, the following XAML will cause this behavior if MyUserControl uses the ViewModelLocator to establish its DataContext. <Page...

Animation with mvvm light on windows phone 7

Hello all, I have an intriguing question. Let's say I want to play an animation or change the visual state etc of my view FROM THE VIEW MODEL. How can I do that? Its for building an MVVM application on windows phone 7. ...

MVVM-Light: Load UserControl into Window

What is the best practice to load an UserControl into an Window with MVVM-Light? Where create the UserControl instance, in the ViewModel from Window or direct in the window? ...

Set UserControl Property in XAML without putting the property in the view

I am a newbie to WPF and MVVM light so hopefully someone can help point me in the right direction. I have a UserControl "Test" and the DataContext is set to the correct ViewModel "TestViewModel" The issue I am having is when I place the control in the MainWindow.XAML I can not reference any of the public properties exposed in the ViewM...

How to create and show views on command request?

Hi, I've started using mvvm-light toolkit , and new to WPF. My question is: I want to create an pplication where the main window includes a grid with 2 columns 1 col command and col2 will display views when each command will be pressed. i want the views to be created on command and colsed from it's own view. I've tried to figure out h...

RaisePropertyChanged for Windows Phone

I'm starting to use the MVVMLight framework and have a question about binding to properties in the ViewModel. I found that I have to call the RaisePropertyChanged method in the setter for the property in order for the View to be updated. And I have to call RaisePropertyChanged from through the dispatcher otherwise I get a thread access...