mvvm

TypeInitializeException on MVVM pattern

System.TypeInitializationException was unhandled Message=The type initializer for 'SmartHomeworkOrganizer.ViewModels.MainViewModel' threw an exception. Source=SmartHomeworkOrganizer TypeName=SmartHomeworkOrganizer.ViewModels.MainViewModel StackTrace: at SmartHomeworkOrganizer.ViewModels.MainViewModel..ctor() at Smar...

Selecting the usercontrol to the relating datatemplate in mvvm

Hello, I have lets say a WeeklyViewUserControl.xaml and a DailyViewUserControl.xaml. Normally I used stuff like this to switch content: <DataTemplate DataType="{x:Type ViewModel:LessonPlannerViewModel}"> <View:LessonPlannerDailyUC/> </DataTemplate> This worked so far. But now I have still the WeeklyViewUC which uses 90 ...

use Services in MVVM

I want to use Services(WCF/RIA /Web) to take data from Entity Data Model class (maybe NHibernate class) and prepared it special for View layer binding. I have few Silverlight page, so should I create for each page separate service class ? Or create one interface and all method will implement it in one service class? Do You have some ad...

How reusable should ViewModel classes be?

I'm working on a WPF application, and I'm structuring it using the MVVM pattern. Initially I had an idea that the ViewModels should be reusable, but now I'm not too sure anymore. Should I be able to reuse my ViewModels if I need similar functionality for a WinForms application? Silverlight doesn't support all things WPF does - should...

Model responsibilities in MVVM

Is Model only Entity Data Model class of my database? Model as simple place where i have my data? Or I can input in Model something more? ...

ViewModel create in MVVM - my look at it

When I want to implement ViewModel I should cut everything c# code from my Silverlight code behind(next delete .cs file and leave only .xaml file) and paste it in new class in new folder ViewModel ? It is good way of separate View from logic ? ...

purpose of use services in MVVM

Where in this pattern I can "place" services, about which I some much hear and want use? What is the purpose of use Services (WCF) in MVVM ? Which of services: Web Services, WCF or RIA is the best and the easiest for MVVM? I only read about realy simple WCF contracts and RIA which have from start create Update,Insert etc method... ...

[WPF/MVVM] Dynamic animation using storyboards

Hello, I develop an application in WPF using the MVVM pattern. I am displaying an oriented graph, with nodes and links (see following picture). http://free0.hiboox.com/images/1110/diapo1c36a4b95802846b8553d2fe9b9e6639.png?26 The user can drag and drop the nodes from one "cell" to another. When the user drops a node, its position is ch...

ItemsControl.ItemsSource MVVM performance

I have an (non-virtualized) ItemsControl that binds its ItemsSource to a ObeservableCollection of ViewModel instances. Now once the large amount Model instances is loaded all the ViewModel complemnents needs to be added to that ObservableCollection. How can I add a large amount of ViewModels without making the UI Thread hang? I suppose ...

Facebook Game Development - .NET - Which architecture?

I am starting to develop a facebook game using ASP.NET + Silverlight Which architecture would you use? ASP.NET MVC or MVVM or RIA Services? ALso what do you think about using XNA with Silversprite? The game won't be a arcade game. It will be more strategy/RPG. Thanks a lot in advance. ...

Binding from View-Model to View-Model of a child User Control in Silverlight? 2 sources - 1 target..

Hi there, So i have a UserControl for one of my Views and have another 'child' UserControl inside that. The outer 'parent' UserControl has a Collection on its View-Model and a Grid control on it to display a list of Items. I want to place another UserControl inside this UserControl to display a form representing the details of one I...

Is it ok to reference .Net assemblies liberally?

I'm building a WPF application and working with the MVVM pattern. I have 4 projects in my solution, 3 class libraries, Data, Model and ViewModel and the WPF executable View. Is there anything wrong with the Model referencing WindowsBase so that I can use ObservableCollection<T> for example or can I just make use of what I intuitively f...

refresh datagrid on view from viewmodel

I have a datagrid on a view that is bound to a viewmodel. When I initialze the view, the datagrid is populated with data from the viewmodel (ObservableCollection) as it should. However, with I try to do a search against the data, the datagrid does not get refreshed from the viewmodel. When I breakpoint the code in my viewmodel, I can see...

MVVM- View Model-View Model Communications

How do I go about having two view models communicate with one another using MVVM Light. I know how to use the messenger class and register etc.. Here is my Scenario A Settings View ---> a Settings View Model . . . A MainPage View ---...

Datatable binding to a form is not working

Hi All i am having a form which are having 4 lables and these lables value are displayed in the 4 textboxs, i am using MVVM and binding these textboxs with the Datatble which is coming through the typed dataset not the problem here is when i add a new row in the datatable with default values of columns and update ui by calling onpropert...

vb.net waiting for webservice for lookup on import in silverlight mvvm.

Hello all I have a problem, I am writing an import CSV to silverlight MVVM the problem I am having is I loop the lines of the stream and then add them to an array, 2 items in the array need to be looked up for the ID I can do that but the problem is they run on a different thread how do I wait for that to return its results and then proc...

Databinding to ObservableCollection in a different UserControl - how to preserve current selections?

Scope of question expanded on 2010-03-25 I ended up figuring out my problem, but here's a new problem that came up as a result of solving the original question, because I want to be able to award the bounty to someone!!! Once I figured out my problem, I soon found out that when the ObservableCollection updates, the databound ComboBox h...

Following Domain Driven Design with MVVM/WPF

Hello, I have plain POCO's here and as INotifyPropertyChanged is a Interface for the View's need its implemented in the ViewModel not the Model. Now I want to show validation errors in the View beside every textbox the user typed in data. I do not want to implemented the IDataErrorInfo interface in my Models because lets assume I am n...

Silverlight MVVM binding seems not to work

Hi everybody! Building my first SL MVVM application (Silverlight4 RC) and have some issues i don't understand. Having a WPF background i don't know what is going on here: ViewModel has several properties, in which one is called SelectedRecord. This is a get only property and is defined like this: public Culture SelectedRecord { ...

How to pass EventArgument information from view to view model in WPF?

I have ListView control in my application which is binded to the collection of CustomObject List<CustomObject>. The CustomObject has seperate view. This ListView has seperate view model. The collection List _customobject is containted in the ListView ViewModel class. My Query: I want to invoke a view that show properties of custom ob...