Click here to Skip to main content
15,911,132 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to get new coordinates after a Rotation Pin
Suresh Suthar31-May-11 20:09
professionalSuresh Suthar31-May-11 20:09 
AnswerRe: How to get new coordinates after a Rotation Pin
_Maxxx_31-May-11 23:45
professional_Maxxx_31-May-11 23:45 
QuestionNeed Silverlight 3d chart Pin
Mikhael Ray Burton31-May-11 12:44
Mikhael Ray Burton31-May-11 12:44 
AnswerRe: Need Silverlight 3d chart Pin
BobJanova31-May-11 23:29
BobJanova31-May-11 23:29 
GeneralRe: Need Silverlight 3d chart Pin
Mikhael Ray Burton1-Jun-11 7:24
Mikhael Ray Burton1-Jun-11 7:24 
GeneralRe: Need Silverlight 3d chart Pin
BobJanova1-Jun-11 12:09
BobJanova1-Jun-11 12:09 
GeneralRe: Need Silverlight 3d chart Pin
BobJanova2-Jun-11 8:00
BobJanova2-Jun-11 8:00 
QuestionIEditableObject and WCF Pin
Mycroft Holmes30-May-11 17:32
professionalMycroft Holmes30-May-11 17:32 
AnswerRe: IEditableObject and WCF Pin
Pete O'Hanlon30-May-11 23:25
mvePete O'Hanlon30-May-11 23:25 
GeneralRe: IEditableObject and WCF Pin
Mycroft Holmes31-May-11 12:58
professionalMycroft Holmes31-May-11 12:58 
QuestionReading materials for WPF Pin
CodingLover30-May-11 2:29
CodingLover30-May-11 2:29 
AnswerRe: Reading materials for WPF Pin
Mark Salsbery30-May-11 6:11
Mark Salsbery30-May-11 6:11 
JokeRe: Reading materials for WPF Pin
_Maxxx_30-May-11 14:07
professional_Maxxx_30-May-11 14:07 
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 
AnswerRe: Applying MVVM (WPF) [long post] Pin
Keith Barrow29-May-11 12:11
professionalKeith Barrow29-May-11 12:11 
jgalak wrote:
The MVVM model seems applicable, but I'm having a hard time applying it.

Yes, WPF and MVVM go hand and glove.

jgalak wrote:
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?

Depends really. My first thought is that you'd need 4 ViewModels and 4 Views, use a "suck it and see" approach.


jgalak wrote:
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.

The article seems closer to Datamodel View ViewModel, which is a good alternative [really as specialised form of] MVVM you can get an idea from Dan Creiver's blog[^]. You can implement the interface on the Enity Data Model: the classes are all partial (Video here[^]) That said there are some objections, some might argue that INotifyPropertyChanged is really a UI construct and is not really "model" stuff. To avoid this you can take a look at a pure MVVM (see Josh Smith's Articl[^]). Note that the disadvantage of this is that changes to the model must come through the viewmodel to be updated on the view, but this is not a problem for you anyway. In either case, the INotitfyPropertyChanged, if implemented correctly in either the model or view model does away with the timer you mentioned.


jgalak wrote:
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?

Yes: Make the user controls strongly typed data templates and type them to the ViewModels. In the Main window set the DataContext to a new instance of the viewmodel you want to show. The viewmodel should handle the instantiation of the model, you can put the database stuff in the viewmodel, or you could consider a repository pattern (easily googled).


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

You raise a command and the ViewModel handles it, again either it commits the changes, or you do it via the repository pattern I mentioned earlier.


jgalak wrote:
I know these are kind of basic

Actually, these are all good questions! Given that you've been out of the loop so long, you've picked up the key techs and points impressively well!

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 

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.