Click here to Skip to main content
15,895,746 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Object looses a Cookie Value in Silverlight Pin
Vimalsoft(Pty) Ltd14-May-11 7:31
professionalVimalsoft(Pty) Ltd14-May-11 7:31 
AnswerRe: Object looses a Cookie Value in Silverlight Pin
Abhinav S15-May-11 5:29
Abhinav S15-May-11 5:29 
GeneralRe: Object looses a Cookie Value in Silverlight Pin
Vimalsoft(Pty) Ltd15-May-11 5:35
professionalVimalsoft(Pty) Ltd15-May-11 5:35 
QuestionMVVM Model Pin
Member 455049313-May-11 1:34
Member 455049313-May-11 1:34 
AnswerRe: MVVM Model Pin
Nicolai Schrade13-May-11 4:04
Nicolai Schrade13-May-11 4:04 
AnswerRe: MVVM Model [modified] Pin
RobCroll14-May-11 0:52
RobCroll14-May-11 0:52 
AnswerRe: MVVM Model Pin
Abhinav S15-May-11 5:27
Abhinav S15-May-11 5:27 
AnswerRe: MVVM Model Pin
_Maxxx_16-May-11 2:45
professional_Maxxx_16-May-11 2:45 
Member 4550493 wrote:
I read about MVVM model. Using MVVM model i can reduce the code behind.

What does it Mean?


The idea of the code-behind reduction is that you remove any code-behind that is not strictly to do with the presentation of the data - thus you separate the presentation completely, allowing the presentation to be changed independently of the rest of the application.


Member 4550493 wrote:
As MVVM model is separating the view, Model and ViewModel.

What is the actual use of ViewModel.


I think of the viewmodel as being what the name suggests - a model of the view. if you're going to have a form that dispays a list, and allows the user to select an item from the list to "do something" with, then the view model will contain a property holding the list's elements, and functionality to "do something" with an element of that list.

You can write tests against the ViewModel without worrying about visual controls, and the ViewModel becomes ,as it were, the specification of the View.


Member 4550493 wrote:
can't I bind the data from model itself rather than ViewModel?


Sure you can - but the idea of the viewmodel its to separate your presentation from dependency on your data - and vice versa. In order to present data to the user, you may need to manipulate that data in some way - and if you do this in the model in order to be able to bind to it, then you're tying your Data to the View. Fine in principal, until something changes

As an example. Say you have a Time stored in the DB and you ant to display it - you retrieve it into a model that contains a DateTime value.
You want to display the time as an analogue clock. So you need angles for the hands.
Easy, you say, add properties of HoursAngle, and MinutesAngle to your model and bind to them.

It works - but it's just Not Right, is it? What business has the model got in presenting angles? What if you now decide youwant to display the time as a percentage of the passage of a day? add more properties to the Model?

A better way is for the model to present the time as a datetime, and the ViewModel to provide bindable properties, where necessary, to provide the Gui representations.

(note this isn't necessarily a real world example - there are other ways of presenting an analogue clock than binding to an HoursAngle propery on a Viewmodel or a Model)

I waffled on for four articles about MVVM - which may help, or may not - see my sig for a link
MVVM# - See how I did MVVM my way
___________________________________________

.\\axxx
(That's an 'M')

QuestionAbout Apllication More Memory usage Pin
Member 455049313-May-11 1:29
Member 455049313-May-11 1:29 
QuestionRe: About Apllication More Memory usage Pin
Mark Salsbery13-May-11 6:15
Mark Salsbery13-May-11 6:15 
AnswerRe: About Apllication More Memory usage Pin
Member 455049315-May-11 5:18
Member 455049315-May-11 5:18 
AnswerRe: About Apllication More Memory usage Pin
Vimalsoft(Pty) Ltd15-May-11 5:39
professionalVimalsoft(Pty) Ltd15-May-11 5:39 
QuestionShow task bar after maximise the window in wpf Pin
Naufalkk13-May-11 0:08
Naufalkk13-May-11 0:08 
QuestionWPF DataGrid - automatically insert new line on tab in last visible column Pin
Nicolai Schrade12-May-11 4:05
Nicolai Schrade12-May-11 4:05 
AnswerRe: WPF DataGrid - automatically insert new line on tab in last visible column Pin
dasblinkenlight12-May-11 4:38
dasblinkenlight12-May-11 4:38 
GeneralRe: WPF DataGrid - automatically insert new line on tab in last visible column Pin
Nicolai Schrade13-May-11 4:00
Nicolai Schrade13-May-11 4:00 
GeneralRe: WPF DataGrid - automatically insert new line on tab in last visible column Pin
dasblinkenlight13-May-11 4:10
dasblinkenlight13-May-11 4:10 
GeneralRe: WPF DataGrid - automatically insert new line on tab in last visible column Pin
Nicolai Schrade13-May-11 4:44
Nicolai Schrade13-May-11 4:44 
Questionincorrect value retrieved. Pin
arkiboys11-May-11 3:35
arkiboys11-May-11 3:35 
AnswerRe: incorrect value retrieved. Pin
Ian Shlasko11-May-11 3:40
Ian Shlasko11-May-11 3:40 
GeneralRe: incorrect value retrieved. Pin
arkiboys11-May-11 3:41
arkiboys11-May-11 3:41 
GeneralRe: incorrect value retrieved. Pin
Ian Shlasko11-May-11 3:48
Ian Shlasko11-May-11 3:48 
GeneralRe: incorrect value retrieved. Pin
arkiboys12-May-11 1:59
arkiboys12-May-11 1:59 
GeneralRe: incorrect value retrieved. Pin
Pete O'Hanlon12-May-11 2:12
mvePete O'Hanlon12-May-11 2:12 
GeneralRe: incorrect value retrieved. Pin
arkiboys12-May-11 3:09
arkiboys12-May-11 3:09 

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.