Coffeehouse Post

Single Post Permalink

View Thread: MVVM
  • User profile image

    spivonious said:

    I found this blog post which builds a very basic MVVM app around a DataSet. It still seems like an unnecessary separation to me, but it does make the code more structured.

    John - the DataSet designer isn't part of the applications View...I'm confused as to why yout think I'd need to create everything in code.

    Okay, I think I have a basic MVVM app working. Here's how it's set up:

    Model - for this I just used the strongly-typed DataSet class. I added methods to support my commands directly to the class file.

    ViewModel - this contains an instance of the DataSet and properties matching up to all of the tables in the DataSet, as well as instances of Josh Smith's RelayCommand.

    View - this is standard XAML with zero code-behind. I added <Window.DataContext><MainViewModel/></Window.DataContext> to the XAML, getting rid of the need to set the datacontext in code.

    Did I do things right? This will at least get me table-level abstraction.