mvvm

wpf mvvm confusion

guys as per my understanding about mvvm is. there is a model (entity class that also implement inotify...), view (xaml code) and some class as vm (kind of controller which normally inherit icommand) to let us make events/commands to be generated on specific event... m just wondering about difference between viewmodel class and xaml'...

using LINQ inside a function ..

public List<NDT_Equipment> GetALLRecords() { using (NDT_DB) { return (from a in NDT_DB.NDTEquipment select a); } } where : NDT_DB - class instance of the autogenerated database context class NDT_Equipment - partial class inside the database context class what I want : return all r...

'Quick Text' editing like in MS word - WPF

I want a special TextBox (May be RichTextBox) in to which I need to type lot of text and predefined fields. When I enter a special char '[' I need to get a VS like intellisense popup and mark the inserted text in a special manner like below So please suggest me a way to make the inserted field selectable as in word. so the double clic...

Binding WPF Toolkit DataGrid ComboBox column to Linq-to-Sql collection after Window loads and connection changes?

Hi All, I am a beginner to MVVM. The main window uses a stock DataGrid from the WPF Toolkit. It has one View Model and relies only on DataContext_Changed event handler in the .xaml.cs file. The main window's DataContext is the View Model. I am attempting to bind the ItemsSource property of a DataGridComboBoxColumn to a CLR property, "...

WPF - Set Focus when a button is clicked - No Code Behind

Is there a way to set focus from one control to another using WPF triggers? Like the following example <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefini...

Bi-directional view model syncing with "live" collections and properties (MVVM)

I am getting my knickers in a twist recently about View Models (VM). Just like this guy I have come to the conclusion that the collections I need to expose on my VM typically contain a different type to the collections exposed on my business objects. Hence there must be a bi-directional mapping or transformation between these two types...

Changing Region Views in Silverlight using Prism

Hi All, I have been learning Prism and Silverlight and am now trying to create a simple application but have run into a snag... What I have is a Shell with 2 ContentControls, "MenuRegion" and "ContentRegion". The way I want it to work is that a user will click on an item in the "MenuRegion" and then the approriate view will be displa...

Display sum of grouped items in ListView

I'm creating a WPF TimeCard app using the MVVM design pattern, and I'm trying to display the sum (total) hours the user has clocked in grouped by each day. I have a ListView with all of the TimeCard data broken into groups using the following XAML: <ListView.GroupStyle> <GroupStyle ContainerStyle="{StaticResource GroupItemStyle}"> ...

MVVM Update binding issue

Hi. I have user control to which I bind a viewmodel, this implements the INotifyPropertyChanged, thru the datacontext, this has a property that is a IList that I bind to the itemsdatasource of a grid, then on the code, in another class I add some values to the list, but the UI doesn't reflect this change although in debug I can see that...

MVVM standardization

Hello, Someone in Silverlight posted that MVVM currently lacks standardization so that everyone has own favor.. That's why Me and a few guys from WPF Disciples are actively discussing about MVVM that everyone agreed. I totally understand that we have implemented the pattern in different ways and we mixed the several patterns or creat...

WPF treeview to be used as menu (MVVM style)

I have a requirement in which a menu should be implemented as a treeview on the left side of a window. I know how to populate the treeview with the (menu)data (the mvvm way). But: how do i hook up each object in the treeview to an ICommand (in the Viewmodel)?? so that e.g. double clicking an object results in opening a window?? Thank...

ASP.net MVC demo projects that use View Models

Hey guys Just wondering if there are any good projects out there that use View Models. I am trying to get my implementation nailed down for how we are going to use VM's and there seems to be a few cross roads that I am coming up to and am wanting to see how other people handle these. Big bonus if the project uses ASP.net MVC 2.0. Che...

ASP.net MVC: Creating SelectList in the view or action?

Hey guys I'm just wondering where people are creating their SelectList - in the action or the view. I have seen examples of both and the one that makes the most sense to me is doing it in the action and have the view model have a property of type SelectList. On the other hand, I have seen examples where people have the view model h...

MVVM multiple views

Im trying to learn MVVM so far its going well , I have stumble on a situation which I don't know how to implement .. What I want : - A view with left navigation and right details pane .. right details will have a contentcontainer which would hold my User Controls for the views to be selected by left pane What I have : - A MainVie...

MVVM with WPF using LINQtoSQL in a DAL along with a BLL

Hey guys I'm hoping someone can get my pointed in the correct direction regarding these new technologies. I'm still in college and unfortunately our school doesn't teach any proprietary technologies(ex. MSFT). I've got decent experience with C# however when it comes to an enterprise level app with all this new stuff, I'm a bit lost. My...

When to use value converters in a mvvm application?

Hi! If one is implementing a WPF application using the MVVM design pattern, is there any situation in which to use value converters? It seems to me that value converters do exactly the same what the view model does too, that is preparing data for the view. So, are there some good uses for value converters? Best Regards Oliver Hanappi ...

How to call a user control method using MVVM?

Hi, I'm working in a WPF project, I'm using the MVVM patter in my project. I created a user control (also in WPF) and I want to use it in my project, now, my problem is that I have a method in my user control that I need to call from my View Model, but I don't know how to do that, how to bind to the method inside my control from the vie...

TabControl disposes of controls on inactive tabs

I'm using the MVVM pattern for my app. The MainWindow comprises a TabControl with the DataContext mapped to the ViewModel: <Window.Resources> <ResourceDictionary> <DataTemplate x:Key="templateMainTabControl"> <ContentPresenter Content="{Binding Path=DisplayName}" /> </DataTemplate> <local:ViewModel x:Key="VM" /> ...

Decouple the screens without magic strings

My WPF project will be organised like this : Screens Group1 Screen1 View.xaml ViewModel.cs Group2 Screen2 View.xaml ViewModel.cs To show the Screen1 from the Screen2 I'll use something like this: ScreenManager.Show("Group1.Screen1") This looks (using reflection) in the Screens.Grou...

Commanding in MVVM (WPF)--how to return a value?

I've been using MVVM pattern for a while now, but I still run into problems in real-life situations. Here's another one: I use commanding and bubble up the event to be handled in the ViewModel. So far, so good. But the project for which I'm using MVVM is actually a class library. Once I run the command code, I need to be able to send...