mvvm

how to animate transition from one view to another when using data templates to associate view with view-model.

Hello everybody, i will post my source code i have at the moment and explain my problem after that. this is the window where i want the transition to happen <Window x:Class="MyApp.MainView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MyApp" Height="600...

How do I go about unit testing view models in the MVVM-Light framework?

My specific question is when the viewmodel constructor is modeled after the MVVM-Light examples, like this one public MainViewModel() { if (IsInDesignMode) { BackgroundBrush = new SolidColorBrush(Colors.Orange); } else { Messenger.Default.Register<Brush>( this, true, ...

WPF Best Practices: Do custom controls work well with the MVVM design?

I was looking at creating a common control that I will be able to reuse on my pages: an AddressControl which has Address1, Address2, City, State, Zip, etc... Originally I just created a class (AddressEntity) that contained all these items and implemented INotifyPropertyChanged. I included that class as a DependencyProperty in my Code-Be...

Question about the responsibility of a ViewModel.

I am building a tool which goal is to download a file based on a few parameters. First step is to set (or retrieve) those parameters. The different parameters sets are retrieved (let's say via configuration files) by a FileDownloadsManager : it knows exactly which parameters to use in order to download the right file. those parameters...

Combobox SelectedItem doesn't update when source changes

Hi all, I have a viewmodel which implement INotifyPropertyChanged. On this viewModel is a property called SubGroupingView. This property is bound to the selected item of a combo box. When i change the combo box, the source property is being updated fine, but when i change the source property or when the control is initialized, the combob...

OnmouseOver on hyperlink showing image in mvvm mvvm light wpf

Hi, I want to use hyperlink in wpf xaml. Whenever mouse comes over the hyperlink, it should show image related to that hyperlink and when mouse gets away the image should disappear. How to go about this using bindings. I am using mvvm light. Kindly Suggest. Thanks ...

Linear navigation in WPF MVVM

Hi, I'm using the Cinch MVVM framework, however I think this is something that relates to all WPF approaches. I want to have a primary screen - Shell or MainWindow - which then contains various viewmodels. To navigate between viewmodels I'm using (or going to use) a tab control styled as a button strip with the content area beneath - w...

Minimal references to PRISM/MVVM to have the support for commands

Hi, I am looking for information to which PRIMS/MVVM ddls I have to reference to in my project to have available Prism/MVVM functionality for handling Commands. I plan to use only this part of the frameworks. Regards, Wojtek ...

Can I suppress the "CanExecute" call within the MVVM pattern

I am working with a tree structure using WPF and the MVVM pattern. I start out by creating 20 root nodes and lazy loading the child nodes as each node is clicked. So for instance ... if I have the following: Level 1 Level 1.1 Level 2 Level 3 Level 3.1 Level 3.2 Levels 1, 2 and 3 are loaded at run time. Levels 1.1, 3.1 and ...

DataBinding Problem In ContentTemplate of a TabControl

Hi, I am in a trouble with databinding of the tabControl's Content Template. I have that class public class MainWindowViewModel : INotifyPropertyChanged { string _text1 = "text1"; string _text2 = "text2"; string _text3 = "text3"; public string Text1 { get { ...

Using behaviours and animations in Silverlight 4 with MVVM pattern

I have seen some great examples of using behaviours to trigger animations in Silverlight. It all seems really easy to do with Expression Blend by simply dragging behaviours onto controls on the screen. But what if my control isn't actually on the screen, since I am using a Listbox bound to a ViewModel in an MVVM pattern. The listbox i...

Customizing Silverlight Dataform's Commands with external controls

I am trying to handling datafrom's internal Add/Delete/Edit command form button control outside datafrom. I am using MVVMLight so. For example : To have Delete in delete button EventToCommand i Bind Command="{Binding DeleteCurrentItemInDataform, Mode=TwoWay}" CommandParameter="{Binding CurrentItem, ElementName=Dataform1}" In ViewModel ...

Architectural pattern for ASP .NET and Silverlight UI

Hello, do you know of any available architectural pattern where the most of the code could be shared between Silverlight and ASP .NET UI? I understand that Silverlight won’t work very well with MVC (although people are blogging on how they achieved this in fact what they did wasn’t pure MVC) and same applies to ASP .NET MVVM. However,...

Inject view into a container MVVM WPF

This has been giving me pain for some time. I know Prism injects views into regions, however is there a way of doing a similar sort of thing with Cinch, on a view first basis? For example I have a container (effectively a region) which can contain any view at runtime - I don't particularly want to set the view explicitly in XAML as this...

Is there a way to change the color of a WPF progress bar via binding to a view model property

I'm wanting a progress bar to change it's color depending on the range the current value is currently in. I was wondering if there was an attribute on the progress bar that I could bind a view model property to to change the color. Does such an attribute exist on the WPF progressbar? ...

How do I switch views in a WPF application using Unity and MVVM?

I am very new to WPF and am trying to set up an application that requires switching of views. For example, a user is viewing a system that contains a number of components, when they click on a component, it should switch to a view that is associated to that component, replacing the previous system view. It's my understanding a Controlle...

Visual Studio 2010 and WPF: Creating a special template

Hi! :-) Is it possible to do the following in VS 2010: Create a new template (or something similar) so I get a XAML - view and a view model, completely with the INotifyPropertyChanged implementation and a view model invoker, all in one? Create a project template that gives me a view and a full view model in App.OnStartup(...) instead ...

How to add DataTemplate into resources?

I have a class Wizard which creates a wizard with pages defined in the same project. The PageViewModel is separated from PageView. PageViewModel is an ordinary C# class derived from PageViewModelBase abstract class and PageView is a UserControl. In order to define a mapping between PageViewModel and PageView I wrote the following code fo...

How to pass two parameters to ViewModel class in Silverlight?

I am studying to use MVVM pattern for my Silverlight application. Following code is from xaml UI code : <Button Width="30" Margin="10" Content="Find" Command="{Binding Path=GetCustomersCommand, Source={StaticResource customerVM}}" CommandParameter="{Binding Path=Text, ElementName=tbName}"/> <TextBox x...

How to implement a progress bar using the MVVM pattern

I have a WPF application which is built on the MVVM design pattern. I wish to implement a progress bar in the app, that follows the MVVM pattern. Does any one have any suggestions on how to implement this? Thanks in advance ...