views:

12

answers:

1

Ok,

Wanting to MVVM an existing app. The code behind contains the following:

private void UploadClick(object sender, RoutedEventArgs e)
{
    /*
     * 1. Clear Messages (ObservableCollection)
     * 
     * 2. Create new OpenFileDialog
     * 3. if(ofd returns ok)
     *     Pass file to Interpreter
     */
}

Basically, what I'd like to know is, how would I 'Commandise' this? Should I use an OpenFileDialog in my command in the VM? - This seems wrong as the OFD is a way of passing in a file that is specific to the view.

But how would I do it? If I hook into the Click event, then call the VM, I'm not using commands...

??

A: 

prob the best person to answer this question would be sasha barber (one of the WPF disiples) so here is a link to an article covering just this topic.

almog.ori
But his one isn't using the OpenFileDialog, he's got a FileUploadService - which is fine if that's the way it *needs* to be.
Chris
Ahhh, I see how he's done it, it's tricky when you can't download the demo code (proxy issues)...Cheers!
Chris