mvvm

Is it Possible to apply a DataTemplate to a Page?

I'm trying to follow the MVVM pattern laid out here: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx#id0090097 I have this in my MainWindowResources.xaml file: <DataTemplate DataType="{x:Type vm:VendorsViewModel}"> <vw:Vendors/> <--- I get a "Can't put a page in a style" error in blend with this </DataTemplate> and I'...

Why is binding refresh delayed until completion of delegate Command? (MVVM)

I'm applying the MVVM pattern. I've got a button which, when clicked, invokes a delegate Command in my ViewModel. At the very start of that delegate method, I set a property value (WaitOn) that should notify the user back in the UI to wait by displaying an animated control. However, the binding to display that animated control doesn...

Prism: Exception handling?

I'm getting an odd result in a Composite Event handler in a Prism app I am writing. I created the event handler and put in an exception statement to verify that the handler is being called: public void OnDateSelected(DateTime selectedDate) { // Temporary code throw new ApplicationException("Not implemented yet."); } I run the ...

Handling view state in Silverlight with MVVM

I am interested to know how you people out there handle the view state in a Silverlight application with the MVVM pattern. Let's say I have a simple search mask that asynchronously calls a webservice. While the search is in progress, I'd like to change the gui accordingly: - Disable the Search button - Enable a Cancel button - etc Usin...

how start implement MVVM pattern

Hello, So i decide to to develop my asp.net site into Silverlight. I today start to search articles about MVVM pattern which i want use in my Silverlight app, and i am confused :/ It's hart to me understand how works this pattern. I am find 3 frameworks which supports MVVM pattern in Silverlight - Caliburn, MVVM Light Toolkit and Goo...

DataTemplate equivalent in Silverlight

Looking for the WPF equivalent of the following: <controls:TabItem Foreground="Black" Header="{Binding Path=Home.Header}" Content="{Binding **Path=Home**, Mode=OneWay}" /> Home is: public ViewModelBase Home { get { return this._homeViewModel; } } Inside my ViewMod...

I still don't get MVVM!

Perhaps I have been doing Flex development with Frameworks like Cairngorm too long but I still don’t get MVVM. I am aware that Cairngorm is a framework and MVVM is a design pattern, but what I am comparing here is Cairngorms implementations of design patterns, mainly the model view controller and the command pattern. Don’t get me wrong,...

What is the best practice for accessing Model using MVVM pattern

I have a database that communicates with webservices with my Model (own thread) and exposes Data Objects. My UI application consists of different Views and ViewModels and Custom Controls. I'm using ServiceProvider (IServiceProvider) to access the Model and route the events to the UI thread. Communication between the ViewModels is handel...

mvvm command setup styles

Commands here would be some variation of Josh Smith's RelayCommand (I call mine a VmCommand), and the question is abouthow your ViewModel creates them. I'm aware of two basic techniques, the first being that you set up all command properties inside the constructor, the second being you instantiate the command lazily inside a property get...

WPF - Handle an ApplicationCommand in the ViewModel

I bet this has been answered many times over, but... For a simple situation where a button on a UserControl has its command property set to something like Find (ApplicationCommands.Find) how would the ViewModel handle that command? I usually see command handlers wired up with a CommandBinding that gets added to a CommandBindings collec...

Unity and MVVM. Class fields become null

Hello! My application is pretty complex, so even simplified example would be complex enough. So I'll try to point some its fundamentals and the problem itself. It is an MDI application. MDI is of custom implementation since there is no native MDI in WPF. The problem is in main container window. It is called Shell and as it is an MVVM ap...

Please recommed a complete guide/book on MVVM for silverlight

Although there are many MVVM for silverlight demo app/article online, but all of them are very simple and not cover mvvm with depth and extension for LOB app. I am looking for a complete MVVM book/demo in depth related to such as WCF Ria Services, Command, etc. ...

Weird problem where Button does not get re-enabled unless the mouse is clicked

My app is written using the MVVM pattern in WPF, and all of my Buttons use Command bindings to execute code in my model. All commands have code in CanExecute to determine the bound Button's Enabled state. The logic works perfectly, but in all cases, the GUI remains in a disabled state unless I click somewhere else in the GUI. For exam...

Data Binding with WPF and MVVM/Model-View-ViewModel

I'm having difficulty correctly Data Binding my models in the view. I have a MainWindowViewModel which contains a list of AlbumViewModels. Each AlbumViewModel holds an AlbumModel. So I have multiple albums and I need to display information in an ObservableCollection in the AlbumModel. I have two ListBoxes. ListBox1 holds the list of...

Set form MinWidth and MinHeight based on child property

I'm writing an application in WPF using the MVVM pattern. In my application I've got an IPopupWindowService which I use to create a popup dialog window. So to show a ViewModel in a popup window you'd do something like this: var container = ServiceLocator.Current.GetInstance<IUnityContainer>(); var popupService = container.Resolve<IPop...

Controls appear inactive when changing content

I'm using a ContentControl to display various ViewModels, which all use DataTemplates for view generation. Now the problem is, after i change the content (by clicking on a hyperlink for example), things such as hyperlinks appear inactive (i.e. grayed out), until i click on the UI again. Is there any way to avoid this behaviour without ha...

WPF Properties on View Model Interface?

Using "vanilla" WPF (no MVVM framework like Prism). Let me say up front that I absolutely advocate coding against abstractions/interfaces vs. implementations whenever possible. In WPF, when you do your bindings in the view, you are really not coding your bindings against the viewmodel interface. You are really binding against an imple...

Is it ok to have a reference there?

Hello I am building a new project with Castle ActiveRecord and have a little technical question. I build my projects workspace and added 5 projects. ViewModel for interfaces and application logic Model for the basic model classes Test for unit testing Client for my WPF client data for my datasource Then i added some references to C...

Engineering techniques to diminish MVVM Driven Development time?

Hi Currently we just start releasing modules for a big project in MVVM but seems like the deliverables are starting to encounter a slowness with this model, such things as the learning curve effort and the fact that mvvm do requires a bit more code than other patterns, What Programming and software engineering techniques do you employ or...

Using MVVM design pattern in .Net 3.0

I have been looking into MVVM design patterns with WPF for a project. I have so far looked at MVVM light, MVVM Foundation, and the WPF Model-View-ViewModel Toolkit. I have a requirement to keep it to .Net 3.0 and not 3.5. I was wondering what frameworks outside of the MVVM Foundation samples use the design pattern or something similia...