mvvm-light

MVVM Light and SL3 Commanding

I am familar with MVVM. Actually been doing most of my learning in SL4. However, with a recent need, I have to use SL3. I am attempting to use MVVM Light v3 with SL3 and utilize commanding. The problem is that in SL3 there is no Command attribute for buttons. I managed to find an old article (http://blog.galasoft.ch/archive/2009/09/26/us...

Is there a way to bind a command to the collapsed event of all TreeViewItems in a treeview?

I am trying to do something similar to what the person in this question wanted to do. Is there any, more elegant, way to do this than the work-around suggested there? (As a last resort) Is there a different mvvm framework that would have better support for doing this? Right now I'm trying to make a custom control that inherits from t...

Silverlight MVVM - Twoway binding not fired on Listbox click

Hi, In a Silverlight MVVMLight 4.0 application I have a listbox, a textbox and a checkbox. The listbox's ItemsSource is bound to a list of objects in the viewmodel. The listbox's SelectedItem is two-way bound to an object (SelectedActivity) in the viewmodel. Both the textbox's Text and the checkbox's IsSelected properties are two-way b...

WPF: Problems with Command when put a ListView inside an Accordion using MVVM Light

Hi guys: I have this View: <Grid Margin="10,0,10,10"> <StackPanel> <wpftoolkit:Accordion Margin="4" HorizontalAlignment="Stretch" Name="accordionCB" ItemsSource="{Binding Path=ContentBlockCategories}" SelectionMode="ZeroOrMore"> <wpftoolkit:Accordion.ItemTemplate> <DataTemplate> ...

MVVM Light and Undo / Redo?

I am probably mixing up some responsibilities (and maybe even terminology) here, but I can't quite wrap my head around this. Is there any relationship between the Command Pattern and the Commands found in MVVM Light (and therefore aswell in WPF)? I would really love to implement some kind of undo / redo mechanism but can't quite figure ...

How should my model look like?

As I am further digging into MVVM and MVVM-light I recognized, that there is no MVVM-light provided base class for models. But from my understanding, messaging and raising notifications could also happen in a model. At least in communication between models I would find that messaging would come in very handy. So I just decided to deriv...

MVVM-Light PropertyChanged ViewModelBase

I would like to understand how the MVVM light toolkit raises the PropertyChanged event. I have a feeling that this may be obvious... but I can't satisfy my curiousity without 100% clarity! I know that this event is raised for each RaisePropertyChanged called, but I'm confused as to why PropertyChanged is raised when the HasValidation...

Silverlight/Windows Phone - EventToCommand DataContext Weirdness

I'm currently using MVVMLight for my WP7 app and have found that the datacontext for an EventToCommand is always the page datacontext. I'm also using the phone.codeplex.com panorama control and had set the datacontext for each PanoramaItem to a different ViewModel but this datacontext is ignored and the page data context is used instead...

How I can dynamically create new TabItems with views and viewModels for a TabControl in Silverlight with the MVVM Light Toolkit?

Hello everybody, I’m a starter with Silverlight and the MVVM Light Toolkit and I don’t know how to proper solve the following scenario: I have the following views with their corresponding viewModels: MainView , the Deault Startpage TabControlView, view with a single Tabcontrol, placed on the MainView… AllBugsGridView, datagrid with...

How do you prevent a base class property from rendering in a DataForm?

Hello all, Please excuse this novice question, but I'm ramping up on Silverlight and MVVM Light. I created a view called MyView.xaml and a corresponding MyViewModel.cs. MyView.xaml <navigation:Page x:Class="Dashboard.Views.MyView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sch...

How to handle ObservableCollection<> result from a parallelized Task in MVVM?

Hi. I am gathering data in a separate Task and I want to data bind the result to a GUI component using an ObservableCollection<>. So my code goes something like this: private ObservableCollection<MyItem> _items; public ObservableCollection<MyItem> Items { get { return _items; } set { if (_items.Equals(value)) { retur...

A super-simple MVVM-Light WP7 sample?

I am looking for a sample that demonstrates in the lightest way possible the following: A Model that invokes a SOAP based web service; regularly polling to get the latest value (assume the SOAP service returns a boolean). The model should also support invoking a SOAP method that changes the boolean on the server. A ViewModel that enab...

Using an interface vs. MVVM light Messenger for data requests

I've got a plugin that needs access to certain information in order to populate its GUI elements properly. However, this plugin should not know about all other plugins, so I want it to request this information from the application. In situations like this, I always create an interface for data exchange, and then pass this interface to ...

MVVM / New Entity / Required Attribute / Validation before submitting

I am using the Required attribute on via the WCF RIA Services Metadata class, with the Entity Framework underneath that. I create a new entity, and let the view bind to the view model. User looks at it for awhile, clicks around, and then attempts to save it. The scenario here is that the user did not tab or click into a fields with a ...

How to expand a TreeViewItems from the inside out as with Josh Smith's WPF example

Josh Smith wrote a clear, consise tour of working with the TreeView control in WPF. The secret to the success is the binding of IsExpanded and IsSelected properties of the viewmodel to the treeviewitems. The paper is here. However after a day of attempting to map his approach to the Silverlight Toolkit TreeView I'm beginning to suspec...

VS2010 for Windows Phone 7 & Blend crash with Mvvm-Light

This is not really a question, but an assertion. Posting this so that others can avoid this problem. If you use Mvvm-Light (and maybe other Mvvm frameworks) and have code in your ViewModel that runs on a thread other than the UI thread, VS2010 and Exression Blend will likely crash when trying to view/edit your XAML in design mode. For ...

How to approach loading displaying different views based on Selected Treeview Node

I need some guidance on the plumbing of an MVVM patterned app. Here's the setup. The page is vertically divided in two. The LHS has a treeview, and the RHS will display the details on whatever item is selected from the tree. The treeview items bind to a few different types of View Models (Customers, Vendors, Employees for example) Se...

Treeview SelectedItem is sometimes the VM and sometimes TreeViewItem

I have a TreeView that the user navigates to select an item for display in a grid. Briefly the XAML looks like this: <local:TreeViewEx x:Name="theTreeView" ItemsSource="{Binding theData}"> <local:TreeViewEx.ItemTemplate> <sdk:HierarchicalDataTemplate ItemsSource="{Binding theChil...

MVVM Light Toolkit: Is it possible to Send a message in the xaml via a trigger?

Is it possible to Send a message in the xaml via a trigger? thanks. ...

How to register to receive all property changes in Mvvm-Light

I want a class (called PremiseServer) in my Mvvm-Light solution (WP7) to subscribe to all property changes for classes that are derived from a base type (SysObject is the base class and it derives from ViewModel). I have a set of classes derived from SysObject. These classes have various properties on them of differing types (Strings, ...