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

WPF

 
Questioncombo box items are not going up/down from keyboard arrow keys. Pin
SRKSHOME17-Oct-10 23:13
SRKSHOME17-Oct-10 23:13 
QuestionWPF MVVM design time data? Pin
SledgeHammer0117-Oct-10 19:42
SledgeHammer0117-Oct-10 19:42 
AnswerRe: WPF MVVM design time data? Pin
SledgeHammer0117-Oct-10 20:03
SledgeHammer0117-Oct-10 20:03 
QuestionA few newb MVVM (WPF) questions... Pin
SledgeHammer0117-Oct-10 16:53
SledgeHammer0117-Oct-10 16:53 
AnswerRe: A few newb MVVM (WPF) questions... Pin
Abhinav S17-Oct-10 18:17
Abhinav S17-Oct-10 18:17 
AnswerRe: A few newb MVVM (WPF) questions... Pin
Mycroft Holmes17-Oct-10 23:40
professionalMycroft Holmes17-Oct-10 23:40 
AnswerRe: A few newb MVVM (WPF) questions... Pin
Pete O'Hanlon18-Oct-10 0:32
mvePete O'Hanlon18-Oct-10 0:32 
GeneralRe: A few newb MVVM (WPF) questions... Pin
SledgeHammer0118-Oct-10 7:57
SledgeHammer0118-Oct-10 7:57 
Hehe...

Ok, so if putting code in the code behind of a view is "allowed" in MVVM, what exactly is the point? I'll use my earlier example of a listbox and 3 buttons Add, Edit and Delete. Add is pretty much going to be a call to _model.Add(), delete is pretty much going to be a call to _model.Delete(), edit is pretty much going to be a call to _model.Update() or whatever. So, I would design my data access layer well and have add, edit and delete functionality THERE, not some chinsy view model. Now I don't mean put GUI stuff in the data access layer, but in my real world application, I have a data access layer that is something like:

public class Widget : INotifyPropertyChanged
{
}

public class Widgets :System.Collections.IEnumerable, INotifyCollectionChanged
{
}

So in this case, the view model would simply do something like:

public Widgets
{
get
{
return GetService<IDataStore>().Widgets;
}
}

that seems like adding a middle man class just for the hell of it doesn't it? I know I have seen some MVVM samples where the data access layer does NOT implement INotifyPropertyChanged and they do it in the VM... but to me that is hella retarded. I shouldn't need to re-implement INPC in every view model that consumes the data access layer objects.

So now the viewmodel seems to be a light weight redirection to the data store. Just to NOT have to put "listBox.ItemsSource = GetService<IDataStore>().Widgets;" in the code behind?

See, thats what I haven't wrapped my head around yet... trying to figure out what the hell the VM actually gives you in a real world application. I guess if you don't have a well designed data access layer it would make sense... but not having a well designed data access layer seems like a much bigger issue to me Smile | :) .

Thoughts? I'm seriously trying to figure this thing out.
GeneralRe: A few newb MVVM (WPF) questions... Pin
Pete O'Hanlon18-Oct-10 9:55
mvePete O'Hanlon18-Oct-10 9:55 
GeneralRe: A few newb MVVM (WPF) questions... Pin
SledgeHammer0118-Oct-10 10:37
SledgeHammer0118-Oct-10 10:37 
GeneralRe: A few newb MVVM (WPF) questions... Pin
Pete O'Hanlon19-Oct-10 2:18
mvePete O'Hanlon19-Oct-10 2:18 
AnswerRe: A few newb MVVM (WPF) questions... Pin
si61821-Oct-10 19:33
si61821-Oct-10 19:33 
AnswerRe: A few newb MVVM (WPF) questions... [SOLUTION] Pin
AndrewSmith22-Oct-10 17:08
AndrewSmith22-Oct-10 17:08 
QuestionConnect silverlight project to web project. Pin
dbrenth15-Oct-10 10:55
dbrenth15-Oct-10 10:55 
AnswerRe: Connect silverlight project to web project. Pin
Abhinav S15-Oct-10 18:41
Abhinav S15-Oct-10 18:41 
QuestionDynamically instantiate UserControl, try to find which UserControl fired an event in an event Handler? Pin
Jean DUSUD14-Oct-10 11:38
Jean DUSUD14-Oct-10 11:38 
AnswerRe: Dynamically instantiate UserControl, try to find which UserControl fired an event in an event Handler? Pin
Abhinav S14-Oct-10 17:24
Abhinav S14-Oct-10 17:24 
AnswerRe: Dynamically instantiate UserControl, try to find which UserControl fired an event in an event Handler? Pin
#realJSOP15-Oct-10 9:04
professional#realJSOP15-Oct-10 9:04 
GeneralRe: Dynamically instantiate UserControl, try to find which UserControl fired an event in an event Handler? Pin
Jean DUSUD18-Oct-10 11:00
Jean DUSUD18-Oct-10 11:00 
QuestionDataGrid SelectionChanged event is firing only on first row selected. Pin
Member 392066714-Oct-10 4:56
Member 392066714-Oct-10 4:56 
AnswerRe: DataGrid SelectionChanged event is firing only on first row selected. Pin
torken214-Oct-10 20:37
professionaltorken214-Oct-10 20:37 
QuestionReportViewer does not export PDF for wingdings fonts Pin
ausadmin12-Oct-10 11:15
ausadmin12-Oct-10 11:15 
AnswerRe: ReportViewer does not export PDF for wingdings fonts Pin
phil.o13-Oct-10 2:24
professionalphil.o13-Oct-10 2:24 
GeneralRe: ReportViewer does not export PDF for wingdings fonts Pin
ausadmin17-Oct-10 10:51
ausadmin17-Oct-10 10:51 
GeneralRe: ReportViewer does not export PDF for wingdings fonts Pin
ausadmin31-Oct-10 12:46
ausadmin31-Oct-10 12:46 

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.