mvvm

WPF Datagrid using MVVM.. is two way binding to DataTable possible?

I have a datagrid in my View with it's ItemSource bound to a DataTable in my ViewModel. When I update the DataTable programmatically (adding a column through a command) the changes are not populated to the View. Also, if I invalidate the View, by switching to another tab and then switching back, the changes made are shown. My ViewModel ...

MVVM With EF, DataAccess design question

Hi all, First and foremost. Sorry about my English, i'm still learning :) I'm currently wrestling with the MVVM model. At the bottom, i have a database. On top of that sits my DAL which is bascily the ADO.NET entity framework. *Note that the different entities are also my business objects (since i include validation in them). On to...

Collapse/Visible UserControls on ButtonClick with MVVM - no swap mechanism -

Hello, In my scenario I have a MainView + MainViewModel, UserControl1 + UserControl 2. In the MainView I have 2 buttons labeled: Button_ShowUserControl1 + Button_ShowUserControl2. At the lower part of the MainView I have a "ContentGrid" which takes/should_take... every UserControl. My goal: When Button_ShowUserControl1 is clicked Us...

Design Patterns in PRISM

Hello guys, I'm in some sort of confusion: at one hand Microsoft architects and surrounding web community promote MVVM pattern for building WPF apps, but from the other hand in Prism patterns and practices they uses absolutely other design patterns - MVP, Presentation Model and Supervising Controller! And not a single example of use pure...

Generic View-Model Editing Support

I have an abstract generic view-model that I use as a base-class for several other view-models. It is defined as follows: public abstract class DiscreteViewModel<T> { protected DiscreteItem<T> _selectedItem; ... } My DiscreteItem class is also generic, and as follows: public class DiscreteItem<T> { public T Display { get;...

I'm in MVVM ViewModel hell

So far, I am really happy with the way things have gone in my app's transition from typical click event handlers everywhere, to complete GUI decoupling. Now I'm running into something I can't quite figure out, and it's related to a window that I want my GUI to pop up, and it needs to display information from the model. I guess the shor...

What to use? MVC, MVP or MVVM or…?

I will start a Java project to develop a desktop application. What to use as presentation layer pattern (MVC, MVP,MVVM or....)? ...if it is possible, with some working small example... :-) Thanks. ...

UI Threading with ViewModels

Collections that are bound in a WPF View must be updated on the UI thread. ViewModel exposes a collection Therefore when collection in the ViewModel is modified it must be done in the UI thread Best practice is to keep ViewModels ignorant of View and presumably such details as Dispatcher. What is the cleanest way to resolve this whil...

The best approach to create new window in WPF using MVVM

In the neighbour post: http://stackoverflow.com/questions/501886/wpf-mvvm-newbie-how-should-the-viewmodel-close-the-form/2100824#2100824 I've posted my vision how to close windows with MVVM usage. And now I have a question: how to open them. I have a main window (main view). If user clicks on the "Show" button then "Demo" window (modal ...

How can I define a IDataErrorInfo Error Property for multiple BO properties

I'm starting to implement validation in my WPF project via the IDataErrorInfo interface. My business object contains multiple properties with validation info. How do I get a list of ALL the error messages associated with the object. My thought is that thats what the Error property is for, but I cannot track down anyone using this for r...

Prism 2.1 Injecting Modules into ViewModel

Hi all, I've been trying to inject the modules from my ModuleCatalog into my Shell's ViewModel but I'm not having much luck... I'm creating the ModuleCatalog in my Bootstrapper and my module is getting onto the screen from its Initializer without problem. However, I'd love to be able to bind my list of modules to a container with a Da...

Silverlight MVVM Where to start

My company is making a big push to silverlight and I am getting everything laid out for this push. I am investigating Prism and MVVM in Silverlight. Is this the best way to go. Anyone know any good END to END Tutorials on MVVM in Silverlight. Thanks ...

Transactional objects in .NET

Hi! In user interfaces there is often a need to implement a cancel button when editing some entities. In WPF it would be nice if you could make your view model transactional. I will try to explain a little bit more in detail what I mean: The view model is connected to the model and exposes data in a way that's easier to handle for the ...

How can I apply MVVM and Commands in this specific WPF situation?

I am having trouble with the MVVM pattern and Commands in my WPF app. The problem is not so much the MVVM pattern, but more the stuff that is going on on my GUI. I'll explain the situation: My app can DoStuff to some files. I have a class with a function DoStuff(int limit). My user user interface has the following items: A Button DoSt...

How to bind objects list to infragistics data grid?

Pretty simple task, but the source code doesn't do required job... Please advise. There is Products collection in the class (approach is based on the MVVm pattern, but that is not influe on the current issue): public class ProductWindowViewModel : WorkspaceViewModel // implements INotifyPropertyChanged { public ProductWindowViewMod...

Using bindings to control column order in a DataGrid

Problem I have a WPF Toolkit DataGrid, and I'd like to be able to switch among several preset column orders. This is an MVVM project, so the column orders are stored in a ViewModel. The problem is, I can't get bindings to work for the DisplayIndex property. No matter what I try, including the sweet method in this Josh Smith tutorial, I ...

How can I apply a custom sort rule to a WPF DataGrid?

When the user does a column sort in my DataGrid, I want all null or empty cells to be sorted to the bottom, rather than the top. I wrote an IComparer<T> that makes sure blanks are always sorted downward, but I can't figure out how to apply it to the columns of my DataGrid. Note that the initial sort of the DataGrid, which I'm doing with...

ListView not updating after RaiseCanExecuteChanged is called

I have a ListView that is bound to a collection of view models. The Item template contains a button that is bound to a command on the view model. When I set the property that the ItemsSource of the ListView I call RaiseCanExecuteChanged for each viewmodel. public BindingList<IVehicleViewModel> Vehicles { get { return _vehic...

Partial Classes across Projects

Is it possible to have partial classes across projects. e.g. Project 1 has a Customer Class. Project2 whish is an optional module adds to the customer class by attaching an order class, and utilising the original Customer Class. ...

Adding MouseBindings to Items in a databound WPF ListView.

Hello, I'm trying to get a command in my ViewModel executed when the user clicks on a item in a ListView. When I add a ListViewItem in XAML I can just add a MouseBinding to its InputBindings. <ListView> <ListView.View> <GridView> <GridViewColumn Header="Test" /> </GridView> </ListView.View> <ListViewItem Content="Item...