mvvm

Hierarchy as grid

I have hierarchy: public class Parameter { public string Name { get; set; } public Value Value { get; set; } } public abstract class Value { } public class StringValue : Value { public string Str { get; set; } } public class ComplexValue : Value { public ComplexValue() { Parameters = new List<Parameter>();...

What is the best ViewModel Collection for WCF RIA Services?

Hi, I'm currently creating an registration application that will register records into different entities in my database. The whole solution is built in SL4, MVVM, Entity Framework and using WCF RIA Services. I have a heap of different views and viewmodels, all containing different types of input controls and bound controls (textboxes, ...

Can i make TreeView remember its structure when raising OnPropertyChanged?

Is it possible to not reset the nodes which are open and closed when the OnPropertyChanged-event is fired and the TreeView updates is ItemsSource? If i add an object now, all nodes collapses! ...

Animation with mvvm light on windows phone 7

Hello all, I have an intriguing question. Let's say I want to play an animation or change the visual state etc of my view FROM THE VIEW MODEL. How can I do that? Its for building an MVVM application on windows phone 7. ...

Why doesn't my viewmodel properties get populated

Hi. I've looked all over and I can't figure out why my viewmodel doesn't get populated. I have this code: _followersRepo = new NotesDomainContext(); _followersRepo.Load(_followersRepo.GetFollowersQuery(), lo => { _followers = new ObservableCollection(_followersRepo.aspnet_Users); }, null); _followingRepo = new NotesDomainConte...

How do I change the visual style of a listitem based on its bound value?

I have a listbox (here's the xaml): <ListBox MinWidth="300" ItemsSource="{Binding Relationships, Mode=OneWay}" SelectedItem="{Binding SelectedRelationship, Mode=TwoWay}" SelectionMode="Single" HorizontalAlignment="Left" > <ListBox.ItemTemplate> <DataTemplate> ...

Getting started with silverlight 3 mvvm

I've just written my first silverlight 3 app. It's written using the code behind in a rater messy way. I want to refactor into mvvm. I'm finding it extremely difficult to find any tutorials on this. So far from what I can gather I'll probably need a mvvm framework. Mvvm-light toolkit sounds like it might be what I want, but I can't fin...

wpf mvvm datagrid selectedrow

Hi, after some google around, I just figured out that there is no one that is using 100% MvvM pattern to get the ToolKit DataGrid events ! Is that impossible or what ? I see too much people using the code-behind... How can I get the SelectedRow or dblClick events using mvvm ? cheers ...

Sharing state/changes across ViewModels

I have an App which has a Tasks tab and a Projects tab. I decided to make a separate ViewModel for each of the tabs, TasksViewModel and ProjectsViewModel. The Tasks tab has a new task area with an associated project pulldown and the Projects tab (obviously) has a list of projects. What I'd like is for the pulldown on the Tasks tab to s...

A viewmodel's role beyond databinding?

I'm a bit confused as to what a viewmodel's role is beyond databinding. I have a menu built in silverlight. The menu has x number of menu items which is determined at runtime. One of the features I would like to add to this is that each menuitem has a different text colour when hovered over. Is it the role of the view to have a colour s...

How can I collapse Silverlight DataGrid Groups using MVVM?

I'm using MVVM in a Silverlight application. So I use a PagedCollectionView as property of my View Model to bind it to a DataGrid ItemSource. But I have this requirement: "all groups in the Grid should be collapse when the user control is loaded.". As I'm using a Page collection View I used this code: this.PinesView = new PagedColl...

MVVM what part of pattern responsible for grouping of datagrid

I've been tinkering around with the MVVM pattern and now I'm trying to implement a little application based on it. This application has a datagrid in which, surprisingly enough, some data is presented. Now I'm trying to add some grouping ability to it. I know how to write this in code (C# and XAML), but I'm wondering in what layer I sho...

WPF MVVM Chart change axes

I'm new to WPF and MVVM. I'm struggling to determine the best way to change the view of a chart. That is, initially a chart might have the axes: X - ID, Y - Length, and then after the user changes the view (either via lisbox, radiobutton, etc) the chart would display the information: X - Length, Y - ID, and after a third change by the us...

In M-V-VM where does my code go?

So, this is a pretty basic question I hope. I have a web service that I've added through Add Service Reference. It has some methods to get list and get detail of a perticular table in my database. What I'm trying to do is setup a UI as follows: App Load Load service proxy Call the GetList(); method display the results in a ListBox c...

WPF/MVVM - should we create a different Class for each ViewModel ?

I'm attempting the example from the excellent "How Do I" video for MVVM by Todd Miranda found in MSDN. I'm trying to adapt the example for my learning purpose. In the example, he has a ViewModel called EmployeeListViewModel. Now if I want to include Departments, should I create another ViewModel such as DepartmentListViewModel? Th...

how to start animation using MVVM?

I am converting my exising Application using WPF and MVVM pattern. I have different storyboards in my view . eg. 1. showing splashscreen while loading the app 2. while clicking Menu Toggle button/Radio Button to show the slide in and Slide out animation effect 3. And different mouseover effect for different elements availa...

Focus-dependent text change for TextBoxes in WPF

Hey there. I'm writing an application in WPF using the MVVM-pattern and will really often use TextBoxes. I don't want to use labels for the user to know user what the text box is for, i.e. I don't want something like this: <TextBlock> Name: </TextBlock> <TextBox /> Instead, I would like the TextBox to contain its own label. Statical...

Initiating UserControl via MVVM in WPF / focus issue.

Hi there I have a few usercontrols loaded into a tabcontrol via MVVM in WPF. Within the XAML for the usercontrol I am setting focus to a textbox using the FocusManager, however this appears to only work when the first instance of the usercontrol is created. Just to test I added a loaded event handler to the usercontrol - this is only ...

PropertyChanged doesn't work properly

Hello, I have a Silverlight application in which I implemented MVVM pattern. In my application there is a child window on which I have ComboBox. I bound ItemsSource and SelectedItem of my combobox to a property (typeof ObservableCollection) and property of MyType appropriately. MyType is a "MODEL" derived from INotifyPropertyChanged. Whe...

How to achieve "Blendability" when using DataServiceCollection in my ViewModel

I'm looking at using oData endpoints in my Silverlight client. Naturally, I'm doing MVVM and I want the project to be nice and "Blendable" (i.e. I must be able to cleanly use static data instead of the oData endpoints when in design mode.) Now to the problem. I'd like to use the DataServiceCollection in my ViewModels, since it allows fo...