Error on creating sample data : Blend Preview for Silverlight 5

Dec 10, 2012 at 1:14 AM

Hi Tony,

I am using your latest version with VS2012 and Blend Preview for Silverlight 5.

When I tried creating a sample data source from a class in Blend, I get an error - 

"Could not load the assembly SimpleMvvmToolkit-SL5 because the following errors occured: GenericArguments[1], 'TModel', on 'SimpleMVVMToolkit.ViewModelDetailBaseCore`2 [TViewModel,TModel]' violates the constraint of type parameter 'TModel'.

Could you please let me know why this is happening?

Coordinator
Dec 14, 2012 at 2:01 PM

You can't use any old class for a ViewModel.  They need to derive from a base class in the toolkit, either ViewModelBase or ViewModelDetailBase.  To get such a class, all you have to do is right-click on the project in the Visual Studio solution explorer, then select Add New Item.  Then find the ViewModelDetail item under the Mvvm category for whatever type of project you are creating (Silverlight, WPF, etc).

Dec 14, 2012 at 3:48 PM

Hi Tony,

Apologies not not being clear. When I said I was trying to create a sample data source from a class in Blend, I meant I was trying to create it from a viewmodel.

But when I click on create sample data from existing object, it throws the error mentioned above. It doesn't even let me choose the viewmodel. If I cancel on the error, it displays other classes but none of the classes in my project.

I am not sure what is happening here. It was working fine with VS2010.

Coordinator
Dec 14, 2012 at 3:56 PM
Which version of Blend are you using? It sound like you're using v4 of the toolkit, which is compatible only with .NET 4.5 and VS 2012. This version uses Portable Class Libraries and generates two assemblies, one of which is .Common. It sounds like you may be missing the Common reference.
Dec 14, 2012 at 3:58 PM
Edited Dec 14, 2012 at 4:46 PM

I am using Blend Preview for Silverlight 5.

I am NOT using Blend that came with VS2012 as the documentation said that for Silverlight 5 projects, use Blend Preview for Silverlight 5.

EDIT:

I just figured out that there is another version of Blend released for VS2012 called Blend + SketchFlow for VS 2012. But this does not have production license. I might download this and give it a try. 

Dec 17, 2012 at 1:29 AM
Edited Dec 17, 2012 at 1:46 AM

OK, I tried out the Blend + Sketchflow for Visual Studio 2012 with my project and I can confirm that there was NO issue in creating sample data using my viewmodel class. (Does not have the Go Live License)

I cannot do this is Blend Preview for Silverlight 5. (Has the Go live License)

I guess I will have to use the 2012 just to create the sample data.

Tony, do you think you can work some magic here so that I can create sample data in the Blend Preview for Silverlight 5?

 

NB: I have the reference to the Common library - SimpleMvvmToolkit-Common (version 4.0.0.0)

Coordinator
Dec 22, 2012 at 12:40 PM

As you can see, the Blend story from Microsoft is less than satisfying, because the current version compatible with VS 2012 is just a "Preview" and does not contain a go-live license.  If you don't want to use it, you have to use VS 2012 to create the sample data.