Click here to Skip to main content
15,898,010 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: MVVM Question Pin
SledgeHammer0114-Feb-11 19:27
SledgeHammer0114-Feb-11 19:27 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 23:19
professional_Maxxx_14-Feb-11 23:19 
GeneralRe: MVVM Question Pin
Pete O'Hanlon14-Feb-11 22:19
mvePete O'Hanlon14-Feb-11 22:19 
AnswerRe: MVVM Question Pin
Abhinav S14-Feb-11 18:21
Abhinav S14-Feb-11 18:21 
GeneralRe: MVVM Question Pin
_Maxxx_14-Feb-11 18:55
professional_Maxxx_14-Feb-11 18:55 
GeneralRe: MVVM Question [modified] Pin
SledgeHammer0115-Feb-11 7:31
SledgeHammer0115-Feb-11 7:31 
AnswerRe: MVVM Question Pin
BubingaMan22-Feb-11 0:05
BubingaMan22-Feb-11 0:05 
GeneralRe: MVVM Question Pin
_Maxxx_22-Feb-11 13:41
professional_Maxxx_22-Feb-11 13:41 
BubingaMan wrote:
the viewmodel's *only* job is to describe what the view looks like.


? Au contraire, surely? The single thing the Vm doesn't do is to describe what the view looks like!


BubingaMan wrote:
It doesn't initialise itself nore does it try to look up any sort of information


Assuming your View is databound to your ViewModel, then your ViewModel needs to get its data from somewhere - and do something with it if it is updated??


BubingaMan wrote:
Handling such events (looking up cust details etc) is done by the relevant controller of these models/views. The controller will look up the cust details (either through a WCF or business call) and initialise the relevant viewmodels from the received results.


So, your VM raises an event (via some singleton) which is handled by some controller which is in a 1-1 relationship with a VM - and deals with the event. Do I follow correctly?

So User selects item in View V1 which is bound to VM1. The VM1 calls a method on EventHandler singleton - say CustomerSelected(CustomerId) - which raises a CustomerSelected event.
Controller2 has previously subscribed to this event via the singleton, and handles it by getting data and calling a method/setting a property on VM2.

Sounds good.

So you have a three-way collaboration? VMn, Vn and Cn with a Singleton as the One Ring to Bind Them All?


BubingaMan wrote:
My viewmodels do NOT communicate with eachother and imo, they shouldn't.


I can see your point of view, but if my assumption regarding the 1-1 relationship between VM and C, there's really little difference, is there? Don't get me wrong, I entirely agree, but tend to design a 'pull' methodology rather than 'push' (i.e. my VM says "I need this customer's info" to the controller, rather than the Controller telling the VM "Edit this data"

I also tend toward a single, singleton Controller which, I think, takes the place of your Singleton event handler and many Controllers.

Thanks for your input.
___________________________________________
.\\axxx
(That's an 'M')

GeneralRe: MVVM Question Pin
BubingaMan22-Feb-11 22:04
BubingaMan22-Feb-11 22:04 
GeneralRe: MVVM Question Pin
_Maxxx_23-Feb-11 12:47
professional_Maxxx_23-Feb-11 12:47 
QuestionHow to return the value in Silverlight? [modified] Pin
Tesic Goran13-Feb-11 22:52
professionalTesic Goran13-Feb-11 22:52 
AnswerRe: How to return the value in Silverlight? Pin
Pete O'Hanlon14-Feb-11 0:32
mvePete O'Hanlon14-Feb-11 0:32 
GeneralRe: How to return the value in Silverlight? Pin
Tesic Goran14-Feb-11 0:56
professionalTesic Goran14-Feb-11 0:56 
GeneralRe: How to return the value in Silverlight? Pin
Pete O'Hanlon14-Feb-11 0:58
mvePete O'Hanlon14-Feb-11 0:58 
GeneralRe: How to return the value in Silverlight? Pin
Tesic Goran14-Feb-11 2:04
professionalTesic Goran14-Feb-11 2:04 
GeneralRe: How to return the value in Silverlight? Pin
Mycroft Holmes14-Feb-11 13:32
professionalMycroft Holmes14-Feb-11 13:32 
GeneralRe: How to return the value in Silverlight? Pin
Tesic Goran14-Feb-11 19:29
professionalTesic Goran14-Feb-11 19:29 
GeneralRe: How to return the value in Silverlight? Pin
Tesic Goran14-Feb-11 22:12
professionalTesic Goran14-Feb-11 22:12 
GeneralRe: How to return the value in Silverlight? Pin
Mycroft Holmes14-Feb-11 23:14
professionalMycroft Holmes14-Feb-11 23:14 
GeneralRe: How to return the value in Silverlight? Pin
Tesic Goran15-Feb-11 0:28
professionalTesic Goran15-Feb-11 0:28 
GeneralRe: How to return the value in Silverlight? Pin
Mycroft Holmes15-Feb-11 13:27
professionalMycroft Holmes15-Feb-11 13:27 
GeneralRe: How to return the value in Silverlight? Pin
Pete O'Hanlon16-Feb-11 7:37
mvePete O'Hanlon16-Feb-11 7:37 
GeneralRe: How to return the value in Silverlight? Pin
Tesic Goran17-Feb-11 1:27
professionalTesic Goran17-Feb-11 1:27 
GeneralRe: How to return the value in Silverlight? Pin
Tesic Goran17-Feb-11 3:18
professionalTesic Goran17-Feb-11 3:18 
GeneralRe: How to return the value in Silverlight? Pin
Pete O'Hanlon17-Feb-11 8:44
mvePete O'Hanlon17-Feb-11 8:44 

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.