Using 3.8.3 right now.
Wanted to add my ViewModel as a data source and then drag it over onto my XAML control, but it doesn't show up when I browse through the project (to click on and select as a new object data source).
Anyone else run into this?
(This is in "Data Sources", "Add New Data Source", "Object")
The Data Sources window uses reflection to find types. So you have to build your solution before it can reflect against your assemblies. Maybe that's the issue?
Of course this only works in VS10 - so I assume you aren't trying this in VS08.
We have rebuilt & then some, yep.
I manually finagled the file by adding a datasource to something else and editing the actual data source file that got created (I am actually OK now), but my coworker who did a GLV simply sees:
'ProductName.Silverlight.ViewModels.OrganizationViewModel is no longer available. Verify the class name is correct and the reference to this class is still valid.'
I was just going to confirm in this reply that going into the add new data source shows everything except the view model, and this time it decides to start showing up. We rebuilt, cleaned solution, closed VS and reentered, refreshed,... I'd swear it wasn't there earlier.
So now I can see everything properly, including ViewModels, when browsing for data source within Add New Data Source (including ones I just create and then build project) and he can see everything except the view models.
I'm sure we'll figure it out, but I'm certainly confused.
(Yes VS 2010)
I had a problem where I couldn't find the datasources because there was a type exposed but wasn't referenced. For example, I was accidently exposing a class from my DAL in my business layer. The UI worked when run because it never invoked anything that actually needed that class, but just the fact that it was publicly visible was enough to screw up VS.
Maybe something similar which you've since resolved? I don't know if that happens in VS2010 though, but I know it was a problem for me in 2008.
I'm not sure what the actual answer was - my coworker had some assemblies in a common public ssemblies directory from some earlier task that he said when removed allowed him to select his ViewModels - and my messing around by adding a datasource to some other class and then manually changing the file seemed to press some magic button for me.
Regardless, both of us can see our ViewModels when adding a new data source now. I'm still not sure exactly what the problem/solution combination was.
Thanks for the replies
I'm working on my first CSLA Silverlight MVVM project and I just hit this! If I change my viewmodel class to be a ViewModel<object> instead of ViewModel<MyCSLBusinessClass> and compile it shows up in my data sources window. If I change it back to ViewModel<MyCSLABusinessClass> it doesn't show up!
That tells me it is something wrong with my business class. ;(
Any suggestions would be appreciated.
The VS designer will actually instantiate the type as you do drag-and-drop. So if there's something blocking the type from instantiating (like it tries to talk to the database when in design mode) that'd cause this issue.
I took all the code out of my ViewModel except for I made it a ViewModel<MyCustomerCSLAclass>. That was enough to keep it from showing up. So here's my work around. Change the code to ViewModel<object>. Then it shows up in the list. Add it to your datasources. Then change it back and recompile. It still shows up.
Yeah, in that case the problem is almost certainly that your viewmodel's constructor is calling DoRefresh or BeginRefresh when in design mode - which calls the business object factory, which tries to call the data portal and fails because the data portal isn't configured to run inside Visual Studio.
Copyright (c) Marimer LLC