Click here to Skip to main content
15,887,683 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Reading materials for WPF Pin
Mark Salsbery31-May-11 7:22
Mark Salsbery31-May-11 7:22 
GeneralRe: Reading materials for WPF Pin
_Maxxx_31-May-11 13:11
professional_Maxxx_31-May-11 13:11 
GeneralRe: Reading materials for WPF Pin
CodingLover30-May-11 18:29
CodingLover30-May-11 18:29 
AnswerRe: Reading materials for WPF Pin
Abhinav S30-May-11 7:22
Abhinav S30-May-11 7:22 
GeneralRe: Reading materials for WPF Pin
CodingLover30-May-11 18:30
CodingLover30-May-11 18:30 
GeneralRe: Reading materials for WPF Pin
Abhinav S30-May-11 20:06
Abhinav S30-May-11 20:06 
QuestionRe: Reading materials for WPF Pin
CodingLover30-May-11 18:32
CodingLover30-May-11 18:32 
QuestionApplying MVVM (WPF) Pin
jgalak29-May-11 10:49
jgalak29-May-11 10:49 
Newbie to WPF/C# here (my last windows programming experience is ages ago - think VB 2.0-6.0). Been out of the programming business for most of a decade, but decided to throw together an app for my current line of work (a practice management tool for my accounting office). Been reading all I can about WPF, C#, etc. The MVVM model seems applicable, but I'm having a hard time applying it.

So here's a simplified version of my question: I have two sets of items to keep track of (more in reality, but I'm trying to keep this general) - Users (for access level management and auditing) and Clients (the clients of the accounting firm, for whom I want to store a bunch of data).

All of the data is going to be stored in a SQL Server database, and accessed through the ADO.Net Entity Data Model. After working with the Entity designer, I get two classes: User and Client. These two classes are, presumably, the "Model" in the MVVM framework.

For both of these, I need to have very similar screens: For users, I need an "All Users" screen - probably a datagrid - which shows a summary list of all current Users, and a "Selected User" screen which shows a full detail view of one User, allowing it to be edited, or allowing a new User to be created.

Similarly, for Clients, I need a "All Clients" and a "Selected Client" screen.

My initial thought is that I need 4 views (All Clients, All Users, Selected Client, Selected User), and 2 view models (UserVM and ClientVM). So my first question is: Am I setting this up right? Or should there be 2 more VMs (UserListVM and ClientListVM)? Or vice-versa, 2 views (list and detail) and 4 VMs?

Following this tutorial: WPF: MVVM (Model View View-Model) Simplified I have attempted to do so, but run into a problem right away - that tutorial (and several others) expect the model class to implement the INotifyPropertyChanged interface. However, since my model class is created by the Entity Designer, it doesn't (as far as I can tell) implement it. How do I deal with this? I suppose I can just use a timed "refresh" event that manually re-reads from the DB, but that seems inelegant.

Next, using the setup from that tutorial, how do I initialize the view? I've built a UserView control (and placed it into my main window) and a UserVM class, all of which bind together with XAML, but when I run it, the control is (understandably) blank. At what point should a User be provided? I'm thinking an overloaded constructor of the UserVM class (using no parameters for a "add user" action, and a single "User" type parameter for an "edit user" function), is there a better way?

Finally, how do I trigger a write back into the DB once a change has been made (when the user clicks the save button)?

I know these are kind of basic, but I'm having a lot of trouble finding just the right level of answers to these questions (most articles/books seem to be either too abstract/high-level or too low-level/"here's how you set a textbox.text property"...)

Thanks,
Juliean.
AnswerRe: Applying MVVM (WPF) [long post] Pin
Keith Barrow29-May-11 12:11
professionalKeith Barrow29-May-11 12:11 
AnswerRe: Applying MVVM (WPF) Pin
_Maxxx_29-May-11 14:27
professional_Maxxx_29-May-11 14:27 
QuestionStorybook.RepeatBehavior not repeating [modified] Pin
Paul R Cotter28-May-11 11:06
Paul R Cotter28-May-11 11:06 
AnswerRe: Storybook.RepeatBehavior not repeating [modified] Pin
Mark Salsbery28-May-11 12:37
Mark Salsbery28-May-11 12:37 
QuestionSilverlight / WPF Every page a content control Pin
DL00127-May-11 5:29
DL00127-May-11 5:29 
AnswerRe: Silverlight / WPF Every page a content control Pin
Mark Salsbery27-May-11 7:33
Mark Salsbery27-May-11 7:33 
AnswerRe: Silverlight / WPF Every page a content control Pin
Abhinav S27-May-11 8:15
Abhinav S27-May-11 8:15 
AnswerRe: Silverlight / WPF Every page a content control Pin
DL00131-May-11 2:58
DL00131-May-11 2:58 
GeneralRe: Silverlight / WPF Every page a content control Pin
Pete O'Hanlon31-May-11 3:26
mvePete O'Hanlon31-May-11 3:26 
QuestionSTYLUS POINT -ELLİPS Pin
mustafayilmaz5627-May-11 3:34
mustafayilmaz5627-May-11 3:34 
QuestionHow to pass a new instance of a viewmodel to an existing usercontrol? Pin
Duke Carey26-May-11 15:08
professionalDuke Carey26-May-11 15:08 
AnswerRe: How to pass a new instance of a viewmodel to an existing usercontrol? Pin
Pete O'Hanlon26-May-11 22:08
mvePete O'Hanlon26-May-11 22:08 
GeneralRe: How to pass a new instance of a viewmodel to an existing usercontrol? Pin
Duke Carey27-May-11 0:42
professionalDuke Carey27-May-11 0:42 
GeneralRe: How to pass a new instance of a viewmodel to an existing usercontrol? Pin
Pete O'Hanlon27-May-11 2:01
mvePete O'Hanlon27-May-11 2:01 
GeneralRe: How to pass a new instance of a viewmodel to an existing usercontrol? Pin
Mycroft Holmes27-May-11 13:54
professionalMycroft Holmes27-May-11 13:54 
GeneralRe: How to pass a new instance of a viewmodel to an existing usercontrol? Pin
Duke Carey31-May-11 0:37
professionalDuke Carey31-May-11 0:37 
GeneralRe: How to pass a new instance of a viewmodel to an existing usercontrol? Pin
Mycroft Holmes31-May-11 13:10
professionalMycroft Holmes31-May-11 13:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.