Wednesday, May 27, 2009

Silverlight in Visual Studio 2010

Hello, Before I start with the article, First I would like to Thank You very much for your wonderful response and feedback to my articles over here and encouragement given time to time. Microsoft MVP Award Program made note of this at their recent blog post :

http://blogs.msdn.com/mvpawardprogram/archive/2009/05/26/indian-mvp-inspired-by-silverlight-3.aspx

Thanks to all of you once again, and I will try my best to keep the same in coming days, So now lets see how to go for Silverlight Project in VS 2010. This is very small post and idea is to get familiar with the new environment of Visual Studio 2010 along with Silverlight Project Template.

I have already wrote about Visual Studio 2010 in my last article.So to start with Silverlight in Visual Studio 2010, Open Visual Studio 2010 and choose Silverlight Template with code behind language of your choice.

Note : While selecting Silverlight Project in Visual Studio 2010, do have a look at “Multi-targeting” feature, Visual Studio 2010 supports .NET Framework 2.0,3.0,3.5 and 4.0. So by chance if you choose 4.0, Note that then it will not get open in Visual Studio 2008, In nutshell, If you want to play around Silverlight in both Visual Studio’s then you need to take care while choosing the framework.

Have a look at picture below :

NewSLPrj

This is new feature in Visual Studio 2010, Now you can “Multi-Target” your Silverlight application by choosing respective Silverlight Version.

Once you open your project with the corresponding version of Silverlight :

NewLook

On left you will find Silverlight Controls. Note that additional controls like Charting tools etc. you still need to download from CodePlex, I am not sure right now about the compatibility of them with Visual Studio 2010, but soon I am giving try for the same. On right you will find the normal design and code layout which is as-is from Visual Studio 2008.

DragDrop

I know, though I can’t see your faces, but I am sure you must be happy to know this that now Drag drop is possible !! :) So now you can do most of the common layout structure here only, Once you drag drop particular control, corresponding XAML code gets generated.

Another good thing is that,let’s say you drag drop a button, now in Visual Studio 2010, if you double-click on it in design window, it will automatically throw you to code behind with respective event of it like this :

CodeBehind

Note : This does not mean that you should stop using Blend, This feature is to provide flexibility to do the normal design which developers generally do to start with placing controls. Blend is more towards hardcore designers to build layouts, whatever it is, still both are tightly integrated.

At the end : One major thing I found missing is : Reduce XAP size option.

In Visual Studio 2008 :

InVS08XAPCache

In Visual Studio 2010 :

InVS10XAPCache

In end, Overall Visual Studio 2010 looks very promising for development of Silverlight applications, so it may not be useful for production purpose since its in early beta and RIA services etc are still missing, but still you can try it out for small applications.

I request you to kindly visit following URLs which already made few discussion on same topic :

http://timheuer.com/blog/archive/2009/05/20/silverlight-and-visual-studio-2010-beta.aspx

and

http://timheuer.com/blog/archive/2009/05/24/silverlight-blend-visual-studio-beta-confusion.aspx

I am soon starting few articles on Silverlight 3, the features which we have not discuss in earlier post, along with that I am planning to start .NET 4.0 in parallel to this so as to have variety flavors. So keep checking this place and once again thanks to all of you.

Vikram.

No comments: