mvvm

How to implement MVVM with NavigationService in Silverlight 4?

I'm new to Silverlight and NavigationService. I try to adopt them with MVVM. I found this link but it don't work for me, may be I do something wrong. (It don't has sample solution) I want to know, are there any website/example out there? ...

multithreaded view models

hello, i have a NavigationWindow that implements a wizard functionality, and a set of Page objects that represent the steps. each Page uses a separate view model. some of these view models spawn worker threads from their constructors. i terminate these threads when the view models are disposed of (they implement IDisposable). further...

MVVM Command without A Button

I want to initiate a bound command, but I don't want to use a Button on my UserControl. In effect the UserControl is itself a Button. When it is clicked anywhere on its surface I want to initiate a bound command. Is there a way to give a UserControl a command? In a side note: one command for one control and only a few certain out-of-th...

MVVM: One ViewModel structure for all Views vs. separate ViewModel structure per View?

Hi I'm new to MVVM and need a bit of help. My application consists of a number of different windows which display controls allowing the user to edit the data in the Business layer. At the moment, each time the user opens a new instance of one of these windows, a ViewModel structure - classes and collections mirroring the Business laye...

Communication between 6 ViewModels and a Messenger == AntiPattern ?

A common approach for communication between 2 ViewModels is this: http://stackoverflow.com/questions/2474768/mvvm-view-model-view-model-communications The Mediator pattern or a Messenger class. But what about 6 ViewModels in one Window? NewSchoolclassUserControl NewPupilUserControl SchoolclassListUserControl PupilListUserControl Pupi...

WPF validation 'before' setting value or issuing command

Greetings, I am relatively new to WPF and have an issue relating to validation with DataGrid control. I have read this article (http://msdn.microsoft.com/en-us/magazine/ff714593.aspx) which covers three different ways to validate, but none of them seem to address how to prevent setting a value or calling a undo/redo command before all v...

Can not locate x:Shared in wpf.

Hi, Please look into this question. http://stackoverflow.com/questions/3795737/issue-with-mvvm-view-first-approach But I'm unable to find "x:Shared" attribute. Please help. ...

Handle Copy & Paste (Clipboard) in MVVM

If I want to access the clipboard with MVVM how can I do it? ...

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 ...

same two user control in xaml

Hi, I have one user control in wpf. And I want to use this user control two times in same view. I am using mvvm approach. Can anybody give me a good suggestion that what approach I should follow. ...

Putting DataService calls into Helper classes ?

I have several ViewModels all doing partly the same: del/add/export etc documents. At the moment the code to call these methods lives in the viewmodels. So I have to copy/paste it... When I put that code in a DocumentHelper class I have it only one time, but do you see any reason against calling database methods from a Helper class? ...

ObservableCollection<T> binding through MVVM doesn't update the view

Hello, I have the following simplified ViewModel public class UserViewModel : IUserViewModel { public DelegateCommand<object> NewUser { get; private set; } public ObservableCollection<UserInfo> UserList { get; set; } public UserViewModel( ) { NewUser = new DelegateCommand<object>( OnNewUser ); this.UserLi...

Silverlight 3 and WCF

Hi I am new to this and hence getting no clue of the solution. I've my silverlight3 app built and WCF services also built and hosted on local host. I'm looking for a way to call methods of my service from my silverlight3 app. i dnt knw the steps and not able to find them through web also. please guide me step by step. its driving me cra...

MVVM problem - binding only certain values

I'm new to MVVM in silverlight. It's a bit confusing because although I get the general idea, there are so many different situations where the method is not very straight forward. Here's one of them: I have a custom text box which when set to blank shows a grayed message 'enter your text here'. The problem is, when binding to my view...

In C# (WPF) does databinding occur when the datachanges in the UI thread immediately?

I'm creating an application and I've been under the assumption that when a control is bound to a member in the view-model (i.e. a TextBox to a string field) the string is updated whenever the user changes the information in the textbox and no later. But what I've found is that the string is updated when the textbox is changed AND when t...

Exposing Entity Framework Entities as properties on ViewModel for MVVM Databinding

If I expose my EF 4 Model objects (EF4 entities) as properties on my ViewModel am I "breaking" MVVM ? Do I have to duplicate each Model class as some sort of DTO and expose those DTOs from the ViewModel ? I understand the theoretical value of having the View "not know" about the Model, but the reality is that (if I don't expose the M...

Windows Phone 7 - Using the Application bar and Prism (or MVVM)

Hi, I am playing around with the WP7 SDK and the Prism for WP7 beta and have come across a problem I can't figure out (or even a workaround for). First of all, I'm new into WPF/Silverlight/WP7 and Prism, so I could be overlooking something very obvious. So I have a Shell page that has my region that is used to hold my content page...

How can I start an animation when a ViewModel property changes?

I have a view model that has a "IsSearchVisible" property. When it gets set to true I want it to start an animation in the view that slides down the search box. Anyway to achieve this in Silverlight/WP7? ...

How to bold & add "*" to TextBlock when Tab Can be saved

I have tabs representing documents, something like in Word. My TabControl is bound to an ObservableCollection<TabViewModel>. TabViewModel has a property CanSave indicating whether a document can be save. When it can be saved, I want to bold it and prefix it with an "*". How can I do this? I think I need to 1st make CanSave a DependencyPr...

C#: Extending from more than 1 class

Suppose I have a ViewModel TabViewModel that Extends ObservableObject the class for ViewModels in the MVVM Foundation Framework. Then I also have a EditorTabViewModel that extends TabViewModel, Now I need to extend DependencyObject to implement DependencyProperties. I cannot extend more than 1 class. How might I implement this? I could h...