mvvm

MVVM firing event back to view

I have a ViewModel where one of its functions is to talk to a service and get some data. However, if there is a problem, I would like a notify the user that the service could not run. Currently what I am doing is firing an event which the view has subscribed to (my viewModel is created in the resources section of the view) and receivin...

How to raise event when Current application property is changed.

I have a WPF application. In my App.xaml.cs I save the full name of the logged in user as follows: App.Current.Properties["FullName"] = GetValueFromDatabase(); I have two screens/windows in the same application. First is the users scrren, which has a an editable WPF data grid where I can update full name of the current user. Seco...

Issue binding Silverlight Custom Control dependency property to Model property

Hi, I have a data navigation user control in Silverlight which opens a child window where the user can enter search criteria and when they press 'Apply' it's suppose to update the bound property in the ViewModel (MVVM pattern.) The links are: SearchDialog <--> DataNavigator <--> MyView <--> MyViewModel The dependency property in Search...

ASP MVC to Silverlight MVVM issues

I am converting an asp.net MVC application to silverlight, and due to the fact I was doing some 'non-standard' things in my mvc app, I am having a hard time trying to work out how to implement it in Silverlight MVVM. Basically I was generating all my views from metadata, including links, buttons etc. One example of this that I can't ge...

Silverlight MVVM Validation in a DataForm

I am using generic data classes, so I can't use ria services attributes to control my validation - so I am looking for a way to manualy set up validation to work in a DataForm. public partial class DataValue { private Dictionary<string, string> _errors = new Dictionary<string, string>(); public Dictionary<string, s...

How to avoid View specific code in my ViewModel

My application has a menu option to allow the creation of a new account. The menu option's command is bound to a command (NewAccountCommand) in my ViewModel. When the user clicks the option to create a new account, the app displays a "New Account" dialog where the user can enter such data as Name, Address, etc... and then clicks "Ok" to ...

Getting Unity to Resolve views in XAML

I'm starting out with MVVM, and I'm starting to understand things. I'm currently experimenting with the Cinch framework, though I'm not committed to it as of yet. I was injecting the ViewModels into the Views using by having a reference to the ViewModel in the codebehind of the view, with the property having a [Dependency] on it, and in ...

Push common ViewModel functionality into a base class?

I'm using MVVM with Prism and Silverlight. I have multiple different views of one model. As I am writing more views their ViewModels seem to duplicate a lot of common code related to handling this one model. Rather than repeating the same common code in all the VMs I am tempted to push it back into the model (which would probably mix ...

Where to put the calls to WCF or other webservices in MVVM?

I'm building Silverlight applicaitions using Prism and MVVM. When calling WCF services on your own server, or even external webservices like the Bing api, would this be done from the Model? or from the ViewModel, thus making the service the Model? ...

WPF Toolkit DataGrid MultiSelect with MVVM - Please Help

Hi, We're using the WPF DataGrid from the WPF Toolkit and are employing MVVM. I'm finding some challenges in using MultiSelect in MVVM and am sure that I'm just missing something simple. I can use the "IsSelected" in the ViewModel to get the event when selecting a row in the DataGrid. This works fine for a single selection. If I set "Se...

WPF ReadOnly Dependency Properties using MVVM

Hi, I've recently overridden the DevXpress WPF grid to give myself a SelectedObject property that I can access from my loosely bound ViewModel. I've made a SelectedObject dependency property and have it bound OneWayToSource in my XAML. Everthing works fine, but if I try to make it ReadOnly (for completeness) I get a compile error and ...

Using Silverlight MVVM with Prism/Unity, and need to detect when view is closed.

I am writing an app using the MVVM (Model-View-ViewModel) pattern and am leveraging the Prism and Unity bits from the Microsoft P&P team. I have a View with a list of items. These items are contained with an ObservableCollection in the ViewModel to which a listbox in the View is databound (the ViewModel is set as the DataContext of the...

Selected item in Silverlight DataGrid

Hi All, I have some XAML like this (silverlight 3.0), <data:DataGrid Margin="0,20,0,0" ItemsSource="{Binding Path=Upgrades}" = AutoGenerateColumns="False" VerticalAlignment="Center" AlternatingRowBackground="AliceBlue" HorizontalAlignment="Left" SelectionMode="Single"> <data:DataGrid.RowStyle> <Style TargetType=...

Case Conventions in wpf using MVVM

Is there a standard for case and naming conventions in wpf/mvvm that differs from C#? I am accustomed to camelCase with the first character being lower case for private and upper case for public methods/properties. In the sample MVVM code I have been examining I have seen a lot of leading _ characters, is this a holdover from another p...

WPF: update UI from ViewModel class (mvvm pattern)

Hi, I'm using the MVVM pattern in my first WPF app and have a problem with something quite basic I assume. When the user hits the "save" button on my view, a command gets executed that calls the private void Save() in my ViewModel. The problem is that the code in "Save()" takes some time to execute, so I'd like to hide the "Save" but...

Where should the data be stored in MVVM?

I've got this Silverlight Prism application that is using MVVM. The model calls a WCF service and a list of data is returned. The ViewModel is bound to the View, so the ViewModel should have a List property. Were should I keep data returned by a WCF service in MVVM? Should the List property be calling into the Model using its gette...

Reactive Extensions (Rx) + MVVM = ?

One of the main examples being used to explain the power of Reactive Extensions (Rx) is combining existing mouse events into a new 'event' representing deltas during mouse drag: var mouseMoves = from mm in mainCanvas.GetMouseMove() let location = mm.EventArgs.GetPosition(mainCanvas) select new { locatio...

MVVM Helper classes Demo Project

Hello All, I am looking for a sample LOB/project that fully use MVVM Helpers by Julmar Technologies. Does any one have any links to share?. Thank you - Rey ...

silverlight - communicate between 2 view models in MVVM using commands

hi all , i am working on MVVM and using commanding in silverlight(DelegateEvent and ICommand) I want something like this ,(say) i have 2 usercontrols , parent and child . Parent is hosting the child , both have thier own viewmodels . On parent i have a button and it executes a simple command , on execute of that command i want to upd...

To MVVM or not to MVVM that is the question

Hi I am rewriting my windows forms based application and I am going to use WPF. The application relies heavily on drag and drop techniques, in a very graphically environment. The uses "Design" reports etc. by dragging elements onto a grid, moving them, right click setting properies etc. all of which is saved to a database. Also control p...