mvvm-light

MVVM Light - using ViewModelLocator - properties hit multiple times

Hi, I'm making use of the MVVM Light ViewModelLocator. I have a class called GlobalViewModelLocator which is hooked up in the resources in the App.Xaml. This class has a static property called Main which returns an instance of the MainViewModel. Then in the MainView.Xaml, I set the datacontext of the usercontrol to bind to the path of ...

Looking for simple MVVM Light example

I'm trying to learn MVVM Light and am looking for a good basic example that shows a model and how to load different views. The template I see after downloading MVVM Light has no models and only one view. (http://www.galasoft.ch/mvvm/creating/) Other things I've found are more complex and a bit confusing when all I want to see are the...

Communication between views

I am abit confused about how to setup the messaging between views. What I am doing is using a radtabcontrol in my mainpage. Each view that is launched after that is bound to a new tab. When the tab needs to be terminated, i.e. user requests a close or it is no longer required, I need to communicate back to the mainpage so it can termi...

Where does the navigation logic belong, View, ViewModel, or elsewhere?

I a button in a view, bound to an ICommand property of the ViewModel (actually it's RelayCommand from mvvv-light) If the user clicks on the button I want to navigate to a new view. Of course the NavigationService is part of the View not the ViewModel. That implies that the navigation is the responsibility of the View? But in my case,...

Property not bound correctly in ListBox DataTemplate

I've been having some trouble getting a listbox to correctly bind to a collection. I'll give the framework code, then explain what I want it to do. XAML Markup: <ListBox DataContext="{Binding Foos, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" ...

MVVM with Windows Phone 7

Hi everybody, Do you know where can I find a detailed documentation/tutorial on MVVM Light and Windows Phone 7 ? I only found short explanations et some very basic tutorials. Thanks, Regards. ...

MVVM-Light : Messenger with TTarget

HI, I try to understant how to send a message directly to a speciciel Target. I got a small SL projet and and a dunmmy class named class1. I register in the class constructor and listenig for all string type message. public class Class1 { public Class1() { Messenger.Defaut.Register<String>(this, f => { TraiteMessage(f); ...

MVVM - WPF DataGrid - AutoGeneratingColumn Event

Hello all, I'm currently taking a good look at the excellent toolkit from Laurent and I have the following question. From Blend 4, I have added an EventTrigger for the Loaded event, in my ViewModel I have the following: public RelayCommand rcAutoGeneratingColumn { get; private set; } In the constructor I have: rcAutoGeneratingColum...

how to pass a complex type using the Navigation framework

How does one pass a complex object to the target Page using the NavigationService.Navigate method? ...

Event to Command in a style

Can someone tell me how to code an event to command in a style for a tabitem? I have no problems using it elsewhere but I can not figure it out for a style. I am trying to do this in Xaml for WPF using MVVM-Light toolkit. Here is an example of what I am trying to do: <DataTemplate x:Key="WorkspacesTemplate"> <igWindows:XamTab...

Silverlight get ListBoxItem from bound list

Hi, I have a ListBox in a file called Downloads.XAML. The items bound to that ListBox come from a bound list in my ViewModel. I have states that are defined in the ListBoxItem style in a different XAML control which need to be fired depending on a property set on the bound item. The problem I have is that I cannot get the ListBoxItem fr...

What is a good way to bubble up INotifyPropertyChanged events through ViewModel properties with MVVM?

I'm trying to figure out the best way to bubble up PropertyChanged events from nested Properties in my ModelView. Say I have my ModelView PersonModelView which has a Property PersonModelView.Address. Address in turn has a property City. When I bind to City in my view, I would do something like {Binding Address.City}. My problem is that ...

MVVM-Light What about events?

I started using MVVM-Light with WPF yesterday and it really makes a difference when it comes to structuring the code. But now i'm trying to figure out how to handle event. Lets say I've got this view, with a TabControl. In every TabItem i have a ListBox. Now how do i handle the event SelectionChanged? And to mess things up, can i send ...

mvvm-light RaisePropertyChanged messenger not broadcasted

I cant seem to get this working properly. I've got two ViewModels. VM1 registers a message with the following code Messenger.Default.Register<PropertyChangedMessage<int>>( this, (action) => DispatcherHelper.CheckBeginInvokeOnUI(() => UpdateOverlayIcon(action.NewValue)) ); VM2 fires the RaisePropertyChanged when property is be...

how to populate the itemssource while scrolling

I would like to retrieve data from my WCF service as the user is scrolling over a datagrid. What are some options for accomplishing this, particularly those that would favour following the mvvm pattern. ...

Is EventToCommand passing EventArgs bad practice?

I've recently been using the MVVM light toolkit for Silverlight 4. I really like the EventToCommand behaviour that is included, it makes life a lot easier. One thing I've been wondering about is if setting PassEventArgsToCommand="True" is bad practice as it will tie a particular RelayCommand to a particular event in the View. E.g. If ...

MVVM Nested databinding

I'm having some trouble with databinding inside a UserControl when using an ItemsControl which has an ItemsSource. My Eventtrigger is never called. I Think the problem is that when I call my eventtrigger in the line: <cmd:EventToCommand Command="{Binding ElementName=layoutroot, Path=DataContext.Checked}" /> it tries to find the chec...

Choosing between bound ViewModel properties or messaging to communicate between ViewModel and View using the MVVM Light Toolkit

I'm using MVVM Light toolkit (which I love). I currently have messaging in place for some interaction originating from the ViewModel and intended for consumption by the View. Typically these types of messages indicate the View should do something like hide itself, show a confirmation message that data was saved, etc. This works. In t...

[WP7][MVVM Light toolkit] Button Command raised too early, before binding when using mvvm-light toolkit

Hi all, I'm using the mvvm-light toolkit in my windows phone 7 application. I have in my view : <TextBox Height="78" HorizontalAlignment="Left" Margin="108,33,0,0" VerticalAlignment="Top" Width="313" Text="{Binding MyValue, Mode=TwoWay}" /> <Button Content="Go" Height="78" HorizontalAlignment="Left" Margin="127,252,0,0" Name="button1...

Placeholder for a control in silverlight

Is there something like a placeholder for a control in silverlight? If I have a dynamically created control in my view-model how can I bind it to some element in Xaml? Is it the right way to achieve that: <ContentControl Content="{Binding MyControl}"></ContentControl> ...