mvvm

WPF MVVM dialog example

Does anyone have any examples of showing a window dialog using MVVM (Prism)? - for example a configuration settings window when a command is executed. All of the examples I've seen use the mediator pattern which is fine, but they also all have a reference to the view in the view model which is not ideal (we're using DataTemplates) Than...

Sending data from view to viewmodel with command binding

Question: How do send data to a view model when using command binding? So that, for example, when i click a button, it sends the "currently selected index" of a list so that it can perform an operation on that item of the list Further Information: I'm working on a program where i have a list of shipments, and each shipment has a li...

WPF Animation "Cannot freeze this Storyboard timeline tree for use across threads"

I currently have a listbox that has its selected item bound to a property on my ViewModel. Whenever the selected item isn't null I want to perform an animation on it. However I keep getting the following error "Cannot freeze this Storyboard timeline tree for use across threads" and from research sort of understand why this is happenin...

Using Silverlight.FX Window for MVVM as a Silverlight 3.0 Page?

I'm creating a Silverlight 3.0 MVVM application using Silverlight.FX but my View is actually using the Silverlight navigation system, a Page. Following Nikhil's example, my View should derive from the Silverlight.FX Window class. What's the best approach to making a Window that also supports the Page functionality or is there something ...

Are MVVM Patterns in WPF and Silverlight identical?

I really appreciate the question (and answers) we already have in “List of WPF functionalities that aren’t in Silverlight 3.” My allegedly new question narrows down the differences between WPF and Silverlight into the context of MVVM. Based on a Shawn Wildermuth MVVM sample project I downloaded from MSDN, I do see that, as of Silverlight...

ASP.NET MVC, MVVM and file uploads...

Hi, I'm big fan of the MVVM pattern, in particular while using the ASP.NET MVC Framework (in this case v2 preview 2). But I'm curious if anyone knows how to use it when doing file uploads? public class MyViewModel { public WhatTypeShouldThisBe MyFileUpload { get; set; } } ...

Binding to commands in WinForms

How can a button be bound to a command in a view model like in WPF with MVVM? ...

WPF, application design advice, and database concurrency.

I am completely new to WPF, so I am spending time trawling the web for examples and tutorials on how things should be done. I have concluded the way forward is to try and use the MVVM pattern as guidance for my application structure. I am completely comfortably with the theory if not with my technical ability. I have one or two questions...

WPF ListBox getting item datacontext OnMouseOver

I currently have a view that contains a ListBox bound to a a collection of view models and a user control that I would like to bind to the current item that the mouse is over. How can I get the current highlighted item in the list and bind it to the user control using only XAML and code in the View Model? Edit: The following image migh...

Silverlight Binding

I've a Silverlight page using a MVVM behind it to handle all the data bits going on. The data context is set for the page using: DataContext="{Binding AddNewClientViewModel, Source={StaticResource ServiceLocator}}" ServiceLocator being a service that allows me to create and inject the appropriate VM using an IoC container. This all ...

WPF - MVVM - NHibernate Validation

Hi, Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on the domain object as below. private decimal _refurbishmentFee; [Min(Value=0), NotNull] public decimal RefurbishmentFee { get { r...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to use ViewModels directly (after all the viewmodels were created to make unit testing easier in a first place). ...

MVVM Sliverlight - can not assign existing control to a property of collection of custom elements in XAML.

I have a class public class Item { public string A { get; set; } public Control B { get; set; } } I'm using MVVM with Silverlight. I have a custom view that is inherited from a standard view. Custom view has public property public ICollection MyItems { get; set; } which should store items described above. In x...

Key press inside of textbox MVVM

I am just getting started with MVVM and im having problems figuring out how I can bind a key press inside a textbox to an ICommand inside the view model. I know I can do it in the code-behind but im trying to avoid that as much as possible. Update: The solutions so far are all well and good if you have the blend sdk or your not having p...

Need help hooking up XML file to WPF DataGrid

Here's what I've done so far: In my App class, I declare a new XmlDataProvider and set the source to a valid XML file (whose Build Action is set to Content/Copy Always). public partial class App : Application { public App() { InitializeComponent(); var services = new XmlDataProvider(); services.Source =...

WPF MVVM User Control binding issues

I have an application that uses MVVM. I have several items on the main window that bind to the ViewModel for that window. When I run it everything works. However, when I add a user control to the main window and try to bind to one of its dependency objects it throws an exception (“Object reference not set to an instance of an object”). T...

VB.net Examples for Prism MVVM In Silverlight

Hey guys IM Looking at Implementing MVVM in Silverlight. Kind of new to Silverlight and I'm Definately new to MVVM Pattern. I get it all But I want A set of small Prism VB.Net MVVM exmaples if that makes sense. Anyone have anything ...

MVVM where to put Data Access Layer?

I am investigating WPF's MVVM design pattern. But am unsure where to put the Data Acess code? In some examples I have looked at, data access is performed directly in the ViewModel. It seems odd to put something like linq to sql in the ViewModel? Other examples have a seperate project for Data Access, this seems more like it? Is this t...

MVVM WPF Question

I am using MVVM pattern to implement a WPF App. My question is, I have a Yes and No Radio Buttons and a text box. ex: Do you own a Car: Yes , No (Radio Buttons) Enter Model:__________ (Text Box) if user selects No, i am disabling it. if user selects Yes and leaves 'Enter Model' Textbox empty, i want to display a message or change backg...

Xaml - add existing control to grid

Trying to develop using MVVM: I have this Csla.PropertyStatus control that is created in my ViewModel. I want to add it in the xaml (via binding, i think) and set some additional properties there (such as the target). I don't know how i could do that, not even if that is possible. I was looking for something like <csla:PropertyStatu...