mvvm

How to combine .NET RIA Services with MVVM in Silverlight 3?

The .NET RIA Services are described as an n-tier framework for Silverlight. I have been wondering what the relation is between this framework and the Model-View-ViewModel pattern. Are they in conflict or can you see the potential for synergic combination? ...

WPF - Best way of responding to changes in a ViewModel at Page/Window level

I'm developing an XBAP and i have a simple requirement. The DataContext of the whole main page is set to an instance of my UserViewModel. The UserViewModel has a DependencyProperty called AuthenticationState which is an enum with values like 'Authenticated','NotAutheticated' and 'AuthenticationFailed'. Now, i need to respond to an...

What is the difference between MVC and MVVM?

Is there a difference between the standard "Model View Controller" pattern and Microsoft's Model/View/ViewModel pattern? ...

System.Windows.Input not available to C++/CLI?

I'm working on a WPF app with a ViewModel in C++/CLI, so it can use legacy C code. I'm having trouble exposing the namespace System.Windows.Input to the C++/CLI code and wondering if this is because WPF doesn't really support C++/CLI? Do I really have to insert a C# layer in order to implement something like Josh Smith's CommandSinkBindi...

Injecting properties into .NET classes post-compile

I'd like to implement the ViewModel part of WPF's MVVM pattern without referencing WPF assemblies. The problematic part is command routing, which requires that ViewModels implement properties of type ICommand so that command bindings can work. Now, I can avoid the ICommand and simply declare the properties as object. Everything still wo...

MVVM - ViewModel which is also a region?

I have a "DataRegion" that is an ItemsControl. I add ViewModels to it and through DataTemplating the views are rendered. My question is that this ItemsControl now needs logic to do with setting up Commands in menus for the Items (they can't do it themselves as it the logic is dependendant on the number of items, i.e. there must be one i...

Selecting all items after binding wpf listview

I have the following XAML: <ListView x:Name="debitOrderItems" ItemsSource="{Binding DebitOrderItems}"> <ListView.ItemTemplate> <DataTemplate> <CheckBox x:Name="checkbox" Content="{Binding}" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}, Path=IsSelected}" /> </DataTem...

How can I connect the ModelView to the Model in this Silverlight MVVM example?

I'm using the article Model View View-Model (MVVM) in Silverlight as a basis to create my own MVVM example in Silverlight. I've got all the pieces below: main page (loads everything) View (XAML file with bindings) Model (a Customer class generating a fake List collection) ModelView (inherits INotifyPropertyChanged and has the Property...

WPF TextBlock dynamic bold and italic parts

Hello, I'm using MVVM pattern and I have string type property in my ModelView. The string may contain following HTML tags: <b>, </b>, <i>, </i> I need to make certain parts of text in TextBlock to be in normal, bold or italic. At moment I have created workaround, a helper method that works like this: Breaks HTML string into parts...

Scaffolding for WPF using MVVM?

Hi there, Can anyone tell me if its possible (if some utility exists??) to create scaffolding taking into consideration MVVM with WPF. My idea here is i seem to have a lot fo data access forms, and of course i would like to Customize them but initially i would like a quick way of providing the form i.e. ALL controls placed on them and ...

WPF MVVM Using Commands vs. Event Handlers

Hello, I like MVVM pattern, once you start using it, you get addicted to it. I know that in perfect world your View code-behind is almost empty (maybe some code in constructor) and every aspect of View is being manipulated from ViewModel. But there are times when creating new fields, properties,commands in ViewModel creates more code ...

Best way to bind controls in two windows in master-detail situation

Assuming that you have two windows where one window has a listbox and the other window should have the detail information for an item currently selected in the listbox. In one window this is easy enough to do but how would one do this with two windows? Unfortunately, two windows is the only option here. ...

Proper way to display pop-ups using WPF M-V-VM pattern

I had a question about the VM responsibilities when it comes to pop-ups. When an app is popping a message box or some kind of dialog (with MVVM), the two options that we have are: putting UI (ShowDialog()) code in VM which seems bad have VM send some kind of event that UI can subscribe to and display a dialog in the code behind (but...

What are your strategies of binding the DataContext in MVVM?

These two 1-hour videos show step-by-step how to use the MVVM pattern to build simple quiz applications in both Silverlight and WPF: Implementing Model-View-ViewModel in Silverlight Implementing Model-View-ViewModel in WPF What amazes me about these is how different they are structurally, for instance, how they use DataBinding: In th...

How do you handle change tracking in MVVM?

I have written a small helper for doing client-side change tracking objects/dtos to use in my ViewModels (see http://viss.be/2009/04/02/modelviewcontext-client-side-change-tracking/) I didn't find a lot of resources about the subject. So I wonder; how do you typically handle it? Thanks, Marc ...

WPF Handle links inside FlowDocument

Hello, I'm building simple dictionary application using WPF. I'm using MVVM pattern, databinding and FlowDocument to display words to user. UI consists of 2 controls: ListBox and FlowDocumentScrollViewer. Dictionary data comes from XML file, format of this string may look like this <b>Word</b> - Some description. Another <i>descrip...

Silerlight MVVM Exception Handling

In an MMVM application, how should exceptions be handled and bubbled? If I get an exception in my model, during an Async callback, and throw an exception, this does not get bubbled to the ViewModel. I suspect that this is because the callback is not running on the UI thread. What's the best practice for this? Mark ...

How to do I send validation messages form model to view in the MVVM pattern?

I've got a small test WPF MVVM application working in which a view allows the user to change the first or last names of customers and the full name automatically changes, so communication is going from M-to-MV-to-V and back, everything is fully decoupled, so far so good. But now as I look to how I will begin extending this to build larg...

Silverlight MVVM Isolated Storage

I've tried to use IsolatedStorageSettings in my ViewModel, but these are not getting retained across browser refreshes (F5). for example; //look in the IsoStore for remembered details IsRememberMe = IsolatedStorageSettings.ApplicationSettings.Contains(Constants.LOGIN_REMEMBERED_USERNAME); if (IsRememberMe) { ...

Do you know any real-world, useful WPF/Silverlight applications using MVVM?

I'm looking for code of full applications that (1) use the MVVM pattern and (2) are approachable for WPF/Silverlight/MVVM beginners. So far I have only found: Crack.NET - A runtime debugging and scripting tool (useful but quite complicated) CipherText - WPF Password Manager (perfect but written in VB.NET) What are some others? prefe...