mvvm

Creating a dynamic checkboxes against the list of items using mvvm light wpf?

Hi, I have the following scenario: I have one window say MainWindow where I am displaying the list of activities as per the specific user from the database. There is a one button present on the window. By clicking on that button a new window is getting opened having all the list of activities from the master table. Now I want add a che...

Inject toolbar into another view

I'm using mvvm for my new project. I have a message dispatcher to send messages between viewmodels but in one case I have to receive messages in a view. This view contains a toolbar panel that must contain the toolbar related to detail view (example editing a customer needs a toolbar with Save, Undo, Redo, Cancel). The problem is that I...

Master/Detail in separate viewmodels?

I am designing a master/detail view. Currently, I have a user control (detail) in my main view, and both have thier own vm. On the one hand, I think there should only be one vm because the detail will never exist without the master. It would also be easier to handle the CRUD process in one vm because of their tight dependency on one anot...

WPF MVVM TreeView selected item not populating current selection object

I'm using WCF and MVVM pattern to populate a tree view control and I need the selected item passed as a parameter for another method in the view model (to populate a different control). The treeview populates just fine but the selected value is not being passed to the view model. e.g. in the viewmodel: private ICollectionView m_S...

Handling the "X" close button in WPF under MVVM

I'm creating a basic database application in WPF, and I have started using the MVVM pattern. I have a dialog that asks the user to select an item from a ListBox and click "OK." After that, I take the item the user clicked from a property in the view model and pass it into another dialog. But if the user clicks "Cancel," I set that valu...

WPF + MVVM - How to bind a property to the parent view's data context.

Working with the MVVM pattern, I have a pair of view model classes that represent a two-tier data hierarchy, each with a corresponding UserControl that represents its view. Both view model classes implement INotifyPropertyChanged and the root level view model exposes a property that is relevant to both its own view and the child view. T...

Silverlight 4 DataTemplate DataType

Silverlight 4 is out and it seems we've missed the DataTemplate DataType functionality in this release again, which is pretty pivotal for MVVM support IMHO. For my WPF apps, at this point, I'm pretty used to globally adding DataTemplates for my Views to my Application.Resources with DataTypes for my corresponding ViewModels: ie. <DataT...

WPF - MVVM - View model hierarchy

Can somone give me an example why would I need a ViewModel taht contains two sub View models ? and how do I implement this ? ...

WPF Binding to specific property

I'm new to DataBinding but would like to accomplish the following: I have a ViewModel which has a collection of objects: CollectionOfStuff Each object Stuff has some properties: Name, Value. In my View, I have a StackPanel with some TextBlocks. I would like to bind the TextBlock's Text property to a specific property. ( I would like t...

MVVM pattern books?

Hello, are there any MVVM pattern books out there or at least books that handle that topic? I couldn't really find any book about that, any recommendation? Thanks! ...

WPF : Conditional templating of textblock

I have a bunch of textblocks in an itemscontrol... I need to know how can I underline the text in the textblock based on whether the text is available in a list in the data model.. Sounds very simple to me...but I have been googling since the past 8 hrs... Can I use datatriggers and valueconverters for this purpose? If yes, then how ca...

Passing DataContext between windows in MVVM

On the main window onClick I have AddNoticeAboutWrongCity addNoticeAboutWrongCity = new AddNoticeAboutWrongCity(); addNoticeAboutWrongCity.DataContext = ((VerificationViewModule)this.DataContext).WrongCityNotice; addNoticeAboutWrongCity.ShowDialog(); At popup window there a lot of textboxes and two buttons Delete object: this.DataC...

WPF MVVM Dilemma: ViewModel as Control-derivate with Style or as POCO with UserControl?

I am currently working on a new project of mine that is going to be a data record visualizer (for records in Pascal). It should provide a way to define a given record with data fields and pointer fields and then there will be an example view where you can see the record "in action". Now the problem I am having is that in this model ther...

Entity Framework CRUD operations on a datagrid

I have a List<T> bound to a datagrid and am trying to figure out how to save all the changes to the database (using Entity Framework), not just one row at a time; OR, at least a better way to commit changes from the datagrid to the database. I am using the MVVM pattern. Here is what I have as far as saving one row: private static P...

WPF new View vs FindResource

We are wiring up our views and view models "externally" meaning we have the following type of code somewhere: var viewModel = new MyViewModel(); var view = Application.Current.FindResource("MyView") as UserControl; view.DataContext = viewModel; That is a paraphrase of sorts. We do this so that the dll containing all of the views can ...

Using WPF Frameworks / Modules in Small Scale Development

I have read quite a few posts on SO and around the web of the benefits and features of various WPF Frameworks (Caliburn, Prism) and Module Frameworks (MEF, Unity) and combining them. In theory, I love the ideas behind them. And I know once I get a grasp on those systems, that it may actually increase development speed - but the upfro...

WPF - Where to put DAL in 3-tier architecture design with MVVM?

I'm fairly new to the whole n-tier architecture thing, and I had some questions about using MVVM with a 3-tier application. From my understanding, we have: The View, or UI layer, which is the xaml file The Model, which is a custom class containing properties and methods that "models" the data object The ViewModel, which is the "adapte...

Multiple List-Controls bound to a ViewModel

Is it appropriate to only set the Visibility-property of an unused virtualizing list-control to Collapsed. I have a ViewModel that implements IEnumerable<SomeType> and have some virtualizing list-controls that bind directly to the ViewModel (declared in markup). At a time always only one of the list controls is visible. Is it appropri...

Dynamical converter in Wpf

I have tabcontrol. At first tabitem I have coordinates in decimal type. At second tabitem I have coordinates in DMS type. When user change something one of them I want that this change will affecting second type Now it only works that when I run application controls for cartesian coordinates are filled. But when I change something af...

How to intercept execution of a RoutedCommand within the view? (WPF / MVVM)

In a WPF / MVVM application, I am trying to find a code-efficient way to set the main view cursor to Cursors.Wait prior to any lengthy operation and to restore it to the default cursor after completion. Since all operations are invoked using routed commands, I'd like to find a way of intercepting command execution, ideally by creating a...