mvvm-light

MVVM Light - CanExecute method on RelayCommand instance always executing

Hi, I tried with a minimal application, just a textbox and a button. The button is binded to a RelayCommand instance, and the CanExecute method just return true or false with a random. The textbox text is binded with a string property. What's making me mad is that the CanExecute method is "always" called: a change of the element focus...

Distinguish between instances of user controls with mvvm-light.

I have two instances of a File Browser user control, the control is just a button and a text box, but I need two instances, think a diff utility. Once the user has selected a file for each control I want to enable a button which will perform an action on both of the files. The problem I am having is how to distinguish between the insta...

Calling or sending values from MainViewModel to other ViewModels mvvm mvvm light

Hi, We are using mvvm light framework to build our application. In our ViewModel folder, we have number of Viewmodel like orderSupplyViewModel,HouseholdSupplyViewModel etc files as per the different functionality of the application. We have included all these viewModels in the MainViewModel by making the MainViewModel as partial class. ...

Silverlight Datagrid column EventTrigger

I have a datagrid with multiple columns. I want to use Interaction.Triggers as a means to fire off a particular method on the view model when only one particular column on the grid changes. How do I find the list of available events for that particular column. I tried using Exp. Blend 4 but I could only see events for the entire datagrid...

Updating listbox data with RaisePropertyChanged

Hi! In my silverlight app i have a view with a listbox: <ListBox Canvas.Left="12" Canvas.Top="72" Height="468" Name="invoiceList" Width="453" ItemsSource="{Binding ElementList}" > <ListBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Name}" /> </DataTemplate> ...

Problem building a silverlight project with MVVM-light on my PC. On other computers it builds.

Hello, I work in a team on a silverlight project. This silverlight project uses MVVM-light. When I want to build the project I get the following two errors: Error 1 : The type 'EventTrigger' does not support direct content. I get this error on this xaml code: <HyperlinkButton x:Name="HyperlinkButtonSelectAll" Content="Select all" IsTa...

how to animate transition from one view to another when using data templates to associate view with view-model.

Hello everybody, i will post my source code i have at the moment and explain my problem after that. this is the window where i want the transition to happen <Window x:Class="MyApp.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MyApp" Height="600...

How do I go about unit testing view models in the MVVM-Light framework?

My specific question is when the viewmodel constructor is modeled after the MVVM-Light examples, like this one public MainViewModel() { if (IsInDesignMode) { BackgroundBrush = new SolidColorBrush(Colors.Orange); } else { Messenger.Default.Register<Brush>( this, true, ...

WPF- How can I stop a popup in a control template from closing when clicked?

The control template is for a custom control. I have seen this question: http://stackoverflow.com/questions/619798/why-does-a-wpf-popup-close-when-its-background-area-is-clicked However I could not figure out how to bind a command to an event in the control template. I tried this: <Popup Name="Popup" ...

OnmouseOver on hyperlink showing image in mvvm mvvm light wpf

Hi, I want to use hyperlink in wpf xaml. Whenever mouse comes over the hyperlink, it should show image related to that hyperlink and when mouse gets away the image should disappear. How to go about this using bindings. I am using mvvm light. Kindly Suggest. Thanks ...

Is MVVM Light for Finanace product building with around 40 modules?

Just wondering should I be going on using MVVM light to buidl enterpside product? I read somewher MVVM is good for starting of small apps and Prism is good for composite apps. Can you please explain what does this mean? I just don't want to have dependency on huge framework like prism as sometimes it takes over the control from you leavi...

Unable to hook into PropertyChanged event using MVVM-Light

Greetings, creating my first MVVM based WPF app and trying to figure out why I'm unable to hook into the PropertyChanged event of a dependency property. Code in the parent view model: void createClients() { var clients = from client in Repository.GetClients() select new ClientViewModel(Repository, client); for...

How to pass multiple parameters and EventArgs properties when using EventToCommand in MVVM-Light toolkit

Hi guys, I am using MVVM Light toolkit for my WPF application and I would like to know if its possible, when using EventToCommand, to pass multiple parameters to RelayCommand and Is it possible to pass properties of EventArgs instead of passing the whole EventArgs ? Regards, Nabeel ...

MVMLight Messaging and Silverlight

I am trying to get a sample to work using MVVM Light and the Messaging Class. In the sample, I have a test project created from the MVVM Template for Silveright 4. I have added a button on the main page. When the button is clicked, it updates a property on the ViewModel. When the property is updated, I want to show a messagebox with ...

RaisePropertyChanged from within Register

I'm having a problem getting the RaisedPropertyChanged to work from inside a Messenger registration action in my Windows Phone 7 app. Am I missing something? Messenger.Default.Register<NotificationMessage<IList<TouchPoint>>>(this, message => { MyList.Add(new ListItem ...

Silverlight 4 Combobox with selectedValue using MVVM-Light

I have recently started using the MVVM-Light toolkit and I am stuck on the following problem: I have a basic Silverlight Combobox that is bound to a viewmodel with an ObservableCollection of type MyUser. The Combobox implements a custom DataTemplate to combine the user’s name and surname. After loading the list of users, how do I set th...

PropertyChanged for all Properties: Message=Property not found

Hello, I want to raise PropertyChanged for all 20 Properties of my ViewModel in once and get the solution: RaisePropertyChanged(String.Empty) see: http://stackoverflow.com/questions/1859946/c-wpf-propertychanged-for-all-properties-in-viewmodel Since I use GalaSoft.MvvmLight.ViewModelBase.RaisePropertyChanged of MVVM Light, I get the ru...

Using WPF DataGridComboBoxColumn with MVVM - Binding to Property in ViewModel

I'm using the excellent MVVM Light Toolkit. My ViewModel exposes: public const string CourtCodesTypeCourtPropertyName = "CourtCodesTypeCourt"; private List<CourtType> _courtCodesTypes = new List<CourtType>(); public List<CourtType> CourtCodesTypeCourt { get { return _courtCodesTypes; } set { if (_co...

MVVM - Deciding which ViewModel is responsible for what

I have a simple app that consists of: Model Items Filter criteria applied to that list of items Views WelcomePage MainItemsPage FilterEditPage I am using MVVM Light and Windows Phone 7 I currently have 3 ViewModels, one for each View. In the past I have had a single ViewModel which made the comunication which I am about to ask...

Is this an acceptable way to test MVVM-Light Toolkit Messages?

[TestMethod()] public void ShowSetup_SendsMessage_WhenShowSetupCommandCalled() { //Arrange Messenger.Reset(); MainViewModel target = new MainViewModel(); bool wasCalled = false; Messenger.Default.Register<NotificationMessage>(this,"Settings",(msg) => wasCalled = true); //Act ...