This version only changes the layout of the datagrid. I wanted to remove some columns but could not use the designer. So I found the below Solution in another Ward Bell post, I copied the piece here so you would not have to look for it. Once grid is linked to the object you can delete the datasouce object in you solution as the designed will still work. Maybe the folks at DevForce can make something that will make this step obsolete.
I’m still not happy about how to raise events in the DataModel that make their way to the View.
I would like to raise an event in the model when the manager starts the fetch and then another one when it’s done. I know that the manager has events and I’m doing the following in the ViewModel works like a champ but I can’t seem to raise the event in the Model , so I’m getting the Singleton instance of the manager in the ViewModel constructor and doing it there, it works but my guess is there is a “better” way
_entityManager.Fetching += delegate { IsBusy = true; }; _entityManager.Queried += delegate { IsBusy = false; };
The Binding between the View and ViewModel is clean and straightforward so I’m wondering what should really be in the ViewModel compared to the DataModel.
Looking for anyone that has used a MVVM pattern with DevForce for their solution of how they decouple the layers.
The DevForce Silverlight Project will place all the shared code in the um Shared Code Folder.
I wonder if there is a way that there could be a Model folder under the shared code folder.
Maybe I just move them as they are only generated once.
begin Ward Post
*************************************************************************************
Here's a recipe that works for me. I just tried it as a modification of our "DevForce Silverlight Tour" application.
- Build your solution (or you won't see the model project)
- Open the xaml class file (can be in either XAML or Designer view)
- Open the Data Sources window
- Click "Add New Data Source"; Data Source Configuration Wizard dialog opens
- Pick the "Object" data source type
- Open the node to the project with your model (if not shown, you may have forgotten to build)
- Check the checkbox(es) next to the entities you'll be binding (e.g, Customer, Employee)
- Click "Finish" button
They should appear in the Data Sources window ... after a pause.
They frequently disappear from the window and it takes awhile (a long while) for Visual Studio to rebuild that window. You will notice that the window rebuilds itself (painfully) seemingly on a whim.
Note that the data sources you created are listed in the DataSources folder under your project's Properties folder
- Twiddle with your Data Source to get it the way you want it (see any demo)
- Drag source on to canvas (see any demo)
- REPAIR !!!
You will almost certainly need to go into the XAML to deal with the junk piled into it.
The generated CollectionView resource is useless to me because I use MVVM. It may be that I just don't know how to use it properly. If I seem less uninterested in it ... that's because I am. You're welcome to follow your own star on this.
Anyway, for me, the CollectionView has done its job and so I soon delete it and the StaticResource binding of the DataGrid (DG)'s or DataForm (DF)'s DataContext to that CollectionView.
I bind DG or DF ItemsSource to the relevant collection property (typically an ObservableCollection<T>) of the ViewModel (e.g,. "vm.Employees").
*********************************************************************
End Ward post
http://www.ideablade.com/forum/uploads/672/DevMEFedMMVMReferenceSL_v1.1.3.zip - uploads/672/DevMEFedMMVMReferenceSL_v1.1.3.zip
|