mvvm

WPF Treeview and ListBox synchronization

I have a treeview which shows a hierarchy of items where each item has a checkbox. I would like to show below the treeview a listbox with all the checked items. How to achieve such functionality using MVVM pattern? Thanks in advance Lukasz Glaz ...

ListView.SelectionChanged to RoutedCommand

I'm working in the MVVM design patter with WPF. I have a context menu with several items in it on a ListView. Based on the number of items selected in the listview, I want to enable/disable certain menuitems. Is there a way to route the selection changed event along with the number of selected items in the listview directly to the vie...

WPF DataGrid: Binding DataGridColumn visibility to ContextMenu MenuItems Ischeked (MVVM)

Hi All, I wan't to control DataGrid columns visibility through a contextmenu available to the user by right-clicking the column header. The contextmenu displays the names of all available columns. I am using MVVM design pattern. My question is: How do I bind the DataGridColumns Visibility property to the Ischeked property of a MenuItem...

How to debug incompatibility between .NET RIA Servces (July Preview) and Silverlight MVVM toolkit?

I have discovered that when I install .NET RIA Services (July preview) it breaks all of my projects that were created with Michael Sync's Silverlight MVVM toolkit. This MVVM toolkit includes a Visual Studio project template which is now failing to build. Here is the message I get: The project file "..\SilverlightModelViewApplication.W...

How do i get the control that is bound to a property in the ViewModel's end?

In WPF, how do I get the control (FrameworkElement) that is bound to a property in a viewmodel's end? I want to create a drop shodow effect on the control. ...

Receiving CommandParameter Value in MVVM

Hi, I am binding my command like: <Button Command="{Binding NextCommand}" CommandParameter="Hello" Content="Next" /> Here, I also bind its CommandParameter property, now how to fetch its value from NextCommand. public ICommand NextCommand { get { if (_nextCommand == null) { ...

Master Detail MVVM WPF not working

Hello Guys, I am unable to get my bindings working on the Detail ListView. I have pasted all my MVVM pattern code below. Please help!!! My View : DirectoryDetailView.cs > <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <ListView Grid.Column="0" ItemsSour...

Where to put Commands when injecting buttons into a ToolBar?

In my composite WPF application I am injecting some buttons into the shell's toolbar from a module. These buttons are injected using the region manager in the module's IModule Initialize function. Since I'm using MVVM and Commands, where would an appropriate place be to put the Command handlers (Execute and CanExecute) for the injected ...

Aggregate detail values in Master-Detail view

I have a master-detail relationship in some custom entities. Say I have the following structure: class Master : INotifyPropertyChanged { public int Id { get; set; } // + property changed implementation public string Name { get; set; } // + property changed implementation public ObservableCollection<Detail> Details { get; ...

MVVM, WPF, and Validation

Well, I think i have a fairly good understanding of MVVM. But I need some clarifications. Is the ViewModel responsible for calling the appropriate service to persist model information? If so, then the ViewModel must have a clean way of determining if the data it holds is valid. If the data is valid, it will update the model accordingl...

(MVVM) Model View View Model And Threading

Hello, I'm playing around with the (MVVM) Model View View Model design pattern but I ran into a problem with the pattern. In my scenario I'm using a DataTable as the View Model. This View Model is set as the DataSource of a DataGridView. Normally, when the Presenter adds a new row to the View Model, a new row is added to the DataGridVie...

Binding ObservableCollection items to UserControl in WrapPanel?

I may just be missing something obvious here, so I apologize if this is a really dumb question. I have a WrapPanel in a view that I need to bind to an ObservableCollection on the ViewModel. This ObservableCollection contains a different type of ViewModel that needs to be bound to another type of view when displayed in the WrapPanel. The ...

MVP/MVVM - Filtering of lists, who has responsibility?

Hi, I'm implementing a wpf application which display a list of items, and provides the functionality to filter this list by typing in a textbox (quite trivial use case i think). We're using a MVVM structure. My question is, whose responsibility is it to filter the list? The view or the viewmodel? Should I implement an "OnTextChanged" ...

MVVM binding DataGrid (WPF Toolkit) to DataTable

I use MVVM for my project, the binding that set to DataTable work correctly at first time, but after I have update data on DataTable, it seem don't effect on DataGrid. Anyone know how to solving it? ...

generate viewmodel from model?

Hello friends, I'm currently writing viewmodels for my (WPF/C#) app. I have to do a lot of copy and paste though. Isn't there a way to generate the viewmodel from the model like generating the model from the database? I haven't found anything about it on the net ... ...

MVVM: Editing a Customer. How to find a workspace with the same object and to create a new workspace from another workspace

Just like this question, I'm learning MVVM using the sample created by Josh Smith and I wanted to add a functionality of update. Two problems arise (not addressed in the referred question): What is the best and light way to create a workspace from another workspace? How to find if there is already a workspace editing the same custome...

How to implement DataTable property with INotifyPropertyChanged

I have created WPF MVVM application, and set WPFToolkit DataGrid binding to DataTable so I want to know how to implement DataTable property to notify changed. Currently my code is like below. public DataTable Test { get { return this.testTable; } set { ... ... base.OnPropertyChanged("Test"); } }...

Event aggregator and collections

Hi, i want to use an event aggregator to syncronize my viewmodel with the view (the viewmodel ovservs the model), this is very simple to implement in the model, simply call notify on the setters of the properties. but it gets more complicated when the model has collections. where should be the code which will call notify? what would be ...

silverlight MVVM Viewmodel to view binding not working

I have a real simple example that works nicely without a viewmodel as i have a Item class that implements iNotifyPropertyChanged public class Item : INotifyPropertyChanged { private string _name; private string _desc; public string Name { get { retu...

WPF MVVM Routed Events

Hi everyone, There are a lot of discussions about M-V-VM and Command binding (RelayCommand) but not a lot has been covered on Routed Events binding to a handler in a M-V-VM pattern. I want to find what is the best approach. Here is an example of RoutedEvent binding using a custom event and a bound event handler to the VM. <Navigation:...