mvvm

Help with Linq Expression - INotifyPropertyChanged

Hello, I'm reading the source code from the latest Prism 4 drop and am interested in solving this problem. There is a base class for the ViewModels that implements INotifyPropertyChanged and INotifyDataErrorInfo and provides some refactoring friendly change notification. protected void RaisePropertyChanged<T>(Expression<Func<T>> prope...

MVVM Light with ASP.Net MVC ?

Hello, I'm a big fan of MVVM Light and I use it in my WPF Application. It works Greeeeat. I have a new project in asp.net mvc. And I'm wondering : Is anyone already tried to use mvvm light and asp.net mvc ? I know that some components will obviously not work but maybe, someone has achieved to do a better job with it. Thanks for your ...

How do you pass a BitmapImage from a background thread to the UI thread in WPF?

I have a background thread that generates a series of BitmapImage objects. Each time the background thread finishes generating a bitmap, I would like to show this bitmap to the user. The problem is figuring out how to pass the BitmapImage from the background thread to the UI thread. This is an MVVM project, so my view has an Image eleme...

Should I use ObservableCollections in my Model in M-V-VM

I'm completely new to M-V-VM and very new to Silverlight, just reading about it for the first time today. As a sample, I am creating a model containing a list of items. My (Silverlight 4) View contains a listbox and my ViewModel will look to the model to retrieve the collection that the listbox will bind to. My question is this. I think...

Display Consistent Value of an Item using MVVM and WPF

In my list view control (or any other WPF control that will fit the situation), I would like to have one TextBlock that stays consistent for all items while another TextBlock that changes based on the value in the ObservableCollection. Here is how my code is currently laid out: XAML <ListView ItemsSource="{Binding Path=MyItems,...

Close View From viewModel using MVVM or without ViewModel

Is there any way to close the view when user click on the close button (X) on the view or I just want to know something like ApplicationsCommand.close don't want to use IRequestCloseViewModel interface. thanks a lot ...

Avoiding mass propagation of properties and events for exposure to ViewModels.

I have an MVVM application I am developing that is to the point where I'm ready to start putting together a user interface (my client code is largely functional) I'm now running into the issue that I'm trying to get my application data to where I need it so that it can be consumed by the view model and then bound to the view. Unfortu...

Is MVVM killing silverlight development?

This is a question I have had rattling around in my head for some time. I had a chat with a guy the other night who told me he would not be using the navigational framework because he could not figure out how it works with MVVM. As much as I tried to explain that patterns should be taken with a pinch of salt he would not listen. My poin...

Memory leak in WPF app due to DelegateCommand.

I just finished desktop apps written in WPF and c# using MVVM pattern. In this app I used Delegate Command implementation to wrap the ICommands properties exposed in my ModelView. The problem is these DelegateCommands prevent my ModelView and View from being garbage collected after closing the view. So it stays larking until I terminate ...

Silverlight textblock binding question + MVVM

Hello everyone, I'm trying to create a simple textblock control and I'm trying to insert a property from my ViewModel in the middle of the string. E.G. "Hello, My name is XX, bla, bla." (XX is a property from my ViewModel) <TextBlock Text="Hello, My name is {Binding SelectedUser.Name}, bla, bla." /> Is that possible? Regards, Ad...

How can I change the VisualState in a View from the ViewModel?

I'm new to WPF and MVVM. I think this is a simple question. My ViewModel is performing an asynch call to obtain data for a DataGrid which is bound to an ObservableCollection in the ViewModel. When the data is loaded, I set the proper ViewModel property and the DataGrid displays the data with no problem. However, I want to introduce a...

Ideal place to compose parts when using MEF + MVVM light toolkit?

Now that I'm working on my newer application that uses MEF with the MVVM light toolkit, I've run into a case where I can't load specific plugins because they rely on a part that isn't getting exported. That part isn't getting exported because it's a View, and the View isn't resolved with MEF (yet). It seems that every time I play with ...

radio button binding in WPF MVVM

can any one tell me how can we enable/ disable button by radio button in MVVM. ...

Wpf popups or modal windows as user entry screens?

I am building an application which has multiple user entry screens. I would like to know if there are advantages/disadvantages of using wpf popups rather than modal windows? I am using mvvm-light. I have noticed that popups are being used extensively in touch applications (eg iPad). ...

Silverlight and M-V-VM - Where should a timer live?

I'm creating a simple monitoring tool in Silverlight. It talks to a web service to retrieve the status information and store it in the ViewModel. This needs to happen once per minute so I'm going to add a timer for this purpose (probably a DispatcherTimer). My question is, where should the timer go in an M-V-VM architecture? In the View...

Should I have one dll or multiple for Business Logic?

In my situation, my company services many types of customers. Almost every customer requires their own Business Logic. Of course, there will be a base layer that all business logic should inherit from. However, I'm going back and forth on architecting this--either in one dll for all customers or one dll for each. My biggest point of con...

WPF TextBox value doesn't change on OnPropertyChanged

I have a TextBox whose Value is binded to a ViewModel property: <TextBox Name="txtRunAfter" Grid.Column="4" Text="{Binding Mode=TwoWay, Path=RunAfter}" Style="{StaticResource TestStepTextBox}"/> The set and get were working fine until I tried to add some validation when the Value is set: private int _runAfter = 0; pub...

Setting a Visual State from a data bound enum in WPF

Hey all, I've got a scenario where I want to switch the visiblity of 4 different content controls. The visual states I have set opacity, and collapsed based on each given state (See code.) What I'd like to do is have the visual state bound to a property of my View Model of type Enum. I tried using DataStateBehavior, but it requires tr...

How to bind Listbox to two properties?

In Silverlight, I have a Grid with DataContext set to class ViewModel. The ViewModel contains list of items (each of them containing int ID and string Text) and an integer "ID", which identifies the currently active item (not selected item). I would like to construct xaml with ListBox where activated item has another color. How can I do ...

How do I link (dependency) properties in my ViewModel?

Simplified example: I have an object that models a user. Users have a first name and a last name. The UserViewModel has a dependency property for my Models.User object. In the declaration of the UserView's xaml, I want to bind a couple of TextBlocks to the first and last name properties. What is the correct way to do this? Should I...