Building Silverlight Applications using .NET

I'm just about to hop on the flight back to Seattle after finishing up a 10 day business trip to Europe where I spoke at conferences and user group events in Budapest, Amsterdam and Zurich.  Although trips like these are a little exhausting, I find them really valuable as a way to connect with developers from around the world, as well as provide me the opportunity to create and deliver new presentations and samples.

One of the talks I delivered on this trip was a new "Building Silverlight Applications using .NET" talk that people seemed to really like. 

Building Silverlight Applications using .NET Talk

I tried to keep the format and samples in this talk simple, and used a model where I used a few slides to explain each programming model concept in Silverlight, and then showed a very simple sample for each concept that helped demonstrate concretely how it worked.

In the talk I covered:

  • XAML
  • Using Shapes and Text
  • Using Controls
  • Layout (Canvas and Layout Managers)
  • Brushes
  • Transforms
  • Handling Events and Writing Code
  • Building Custom UI Controls
  • Reaching out and Programming the HTML of a page from a Silverlight control
  • Handling HTML Events in Managed Code (e.g. html button click handled in C#/VB on the client)
  • Exposing managed APIs to HTML JavaScript in the browser
  • Using the File Open Dialog support
  • Using the HTTP Network APIs
  • Using the Web Service APIs
  • Isolated Storage for local data caching

The slide deck comes to 83 slides - but I think does a good job of explaining everything step by step (it is also an easy deck to read - so even if you don't want to run the samples locally I'd recommend taking a look through the deck since I think you'll find it useful).  You can download the slides + demos of this talk below:

Included in the .zip download are readme instructions on how to run all of the samples on your own machine.

Quick Answer to a Common Question about .NET with Silverlight

One of the most common questions I received when giving the talk was - "do I need to have the .NET Framework installed in order to use Silverlight?".  The answer to this is no - a cross platform version of the .NET Framework is included in the 4MB Silverlight 1.1 download, which means you do not need to have anything extra installed on the client in order to program Silverlight with a .NET programming model in the browser. 

The Silverlight version of the .NET framework includes the same CLR engine (same GC, type-system, JIT engine) that ships with the full .NET Framework, and a subset of the .NET Framework namespace libraries.  You can see the full list of all classes/namespaces that are included by opening up the Object Browser when you create a new Silverlight application using Visual Studio (click here for a sample screen-shot of this).

People are usually pretty stunned/confused to hear that it is possible to get this much stuff in so small and quick an install package.  Let me just say it wasn't easy. <g>

Other Silverlight Talks and Blog Posts

For a broader overview talk of Silverlight, as well as some cool (more complete) samples you can download, please check out my previous "Lap Around Silverlight" talk and blog post here.  You can learn even more about Silverlight from my summary post here.  And you can watch me build a Silverlight application using .NET from scratch in this video here.

The talk above borrowed a number of slides from a few other Silverlight and WPF/E talks that others and I have given (although almost all of the code samples I showed in my talk are new).  In particular, my WPF/E talk from earlier in the year, Jamie Cool and Nick Kramer's Two Talks at MIX, and Stefan Schackow's Extending the Browser Programming Model with Silverlight talk at MIX.  You can watch Jamie, Nick and Stefan's talks online (along with all of the other MIX talks) for free here.

Hope this helps,

Scott

Published Tuesday, June 19, 2007 6:15 AM by ScottGu

Comments

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 10:46 AM by Chad Campbell

This is great!  Thank you so much for posting this content.

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 10:52 AM by Mads Kristensen

That's awesome. Thanks. We are just to do research on Silverlight at work, so this comes in handy.

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 11:23 AM by L. Tauber

Is there a video of the event?

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 11:31 AM by Cat Chen

I guess Office 2003 format files saved by Office 2007 are so big for they contain both Office 2003 and 2007 format data. If there're a lot of smart arts in the file, they will be saved as bitmaps for Office 2003 compatibility and use a lot of space.

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 11:52 AM by Josh Stodola

Awesome Scott, thanks for making those slides available for download, I am looking forward to watching them tonight.

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 2:28 PM by Granville Barnett

Hi Scott,

When are you coming back to the UK?  Your talks at WebDD went down a storm!

- Granville.

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 2:37 PM by orcmid

Nice, very nice.  I think this will be a great way for people to get in on cross-platform .NET/CLI development.

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 2:57 PM by Mike

Sooo, what's in the MS.Internal namespace? ;-)

# re: Building Silverlight Applications using .NET

Tuesday, June 19, 2007 3:08 PM by Mike2

What happens when you put controls from System.Windows.Controls on your canvas? Wil they look like regular controls? Does that follow your theme? How do they look on the Mac, like native controls? Is there something like skinning? If .NET 3.5 is released with new classes in any of these namespaces, will they become available in Silverlight (are they in sync) or is that then postponed to Silverlight 2? If that's the case, wouldn't Silverlight be more of a .NET fork with a risk of the namespaces growing apart?

Wow! That's like almost 10 questions, hope you'll answer them, thanks!

# re: Building Silverlight Applications using .NET

Wednesday, June 20, 2007 12:08 AM by Matt S

Scott, how about doing a screencast of your presentation?

# re: Building Silverlight Applications using .NET

Wednesday, June 20, 2007 1:33 AM by Andrej Macko

Hi Scott, thank you so much talking here, it was interesting not only from the technical view but also to see the man doing that much stuff - we thought this blog are writing some other folks, so a big wow it comes from you alone :o)!

Bye,

Andrej

# re: Building Silverlight Applications using .NET

Wednesday, June 20, 2007 2:35 AM by Twan

You mentioned that a cross platform version comes with Silverlight. Can we expect a full blown cross platform version in the not so far future, so that we developers can finally target other OSes using the .NET Framework?

# re: Building Silverlight Applications using .NET

Wednesday, June 20, 2007 3:09 AM by Michael

I really enjoyed your talk on Silverlight in Amsterdam. When I returned to work the next day, I told my collegues about this new innovation. I'm hoping I can make management as enthousiastic as I am about Silverlight. I really think this is a great opportunity for our customers! Thank  you!

# re: Building Silverlight Applications using .NET

Wednesday, June 20, 2007 3:32 AM by Vincent van der Laan

Hi Scott,

I attended your talks in Amsterdam.

Now i want to show my collegues some demos you showed us but i cant find them on the net.

Do you have a URL for :

Top Banana

Silverlight Jigsaw

Thanks in advance

# re: Building Silverlight Applications using .NET

Wednesday, June 20, 2007 7:49 AM by Ullas

Thank you very much Scott. I was just started researching on Silverlight and .Net 3.0 I think your samples will help me. i am facing issues with opening .XAML files in VS2005 (i installed the VS extension for 3.0) Could you please give me your thoughts ??

# re: Building Silverlight Applications using .NET

Thursday, June 21, 2007 3:25 PM by Jorrit Posthuma

Hi Scott,

I went to your talk about Silverlight in Amsterdam. And even my friend who is definatly NOT a Microsoft fan,( and other students i told about it ), were really impressed about it. So i hope it will be the next big think in web-development.

btw, are you going to ship Silverligth with Vista SP1, that would be very nice for the spreading of the software.

All so you promised that Siverligth will be installed very quickly and yes, it does, I installed it in 4!!!! seconds. Something where adobe and others can learn a lot from :).

Jorrit Posthuma

( Sorry for my bad English )

# re: Building Silverlight Applications using .NET

Thursday, June 21, 2007 4:53 PM by Josh

Great talk, Scott.  I'm getting really stoked about Silverlight, except there's one fly in the ointment... We need low-level socket support for it to be useful to us.  Add that and my entire development group will switch over from Flex tomorrow--no joke.  Who do I need to bribe?

# re: Building Silverlight Applications using .NET

Thursday, June 21, 2007 5:32 PM by ScottGu

Hi Ullas,

Do you have the Silverlight tools alpha installed on top of VS "Orcas" Beta1?  You need this installed, since it supports the specific dialect of XAML that Silverlight uses.

Thanks,

Scott

# re: Building Silverlight Applications using .NET

Thursday, June 21, 2007 5:33 PM by ScottGu

Hi Jorrit,

Glad you enjoyed Silverlight! :-)  

Thanks,

Scott

# re: Building Silverlight Applications using .NET

Thursday, June 21, 2007 5:33 PM by ScottGu

Hi Josh,

We'll support sockets with Silverlight 1.1 - so hopefully that will make your development groups day! :-)

Thanks,

Scott

# re: Building Silverlight Applications using .NET

Thursday, June 21, 2007 6:52 PM by Josh

Wow, thanks! If I'd known it would be that easy I'd have asked for a few more things, like bitmap effects, for instance :-)

# re: Building Silverlight Applications using .NET

Friday, June 22, 2007 5:05 PM by Patrick

this is reallly! cool thanks a lot!

# re: Building Silverlight Applications using .NET

Saturday, June 23, 2007 7:44 PM by Bram

Hi Scott,

I saw you at the TechED 2007 Events. Truly inspiring! Just to let you know.

best regards,

Bram.

# re: Building Silverlight Applications using .NET

Sunday, June 24, 2007 9:02 PM by Krishna Kumar

Scott, we are investigating the possibility of using Silverlight in an ASP.NET application for some analysis/reporting needs. What support does Silverlight provide for printing needs?

# re: Building Silverlight Applications using .NET

Monday, June 25, 2007 3:18 PM by Román

I would like to know if there's a way one can remove the default link that Silverlight points too when it detects the client needs the download it to avoid connecting to the internet in case of a Silverlight application deployed to an intranet.

# re: Building Silverlight Applications using .NET

Thursday, June 28, 2007 1:51 AM by Charles Okwuagwu

Hi Scott,

Is it possible to access the directX stack from silverlight code?

this scenario will realy offer very intersting/advanced possibilities on the windows/silverlight platform

Keep up the cool work.

# re: Building Silverlight Applications using .NET

Thursday, June 28, 2007 2:48 AM by ScottGu

Hi Charles,

You can't use directx within Silverlight because Silverlight is designed to be cross platform - and DirectX is only supported on Windows.  You can, though, integrate DirectX with WPF with teh full .NET Framework.

Hope this helps,

Scott

# re: Building Silverlight Applications using .NET

Thursday, June 28, 2007 5:47 AM by Charles Okwuagwu

I here you clearly scott on the cross platform issues, but to be fair to the windows community, dont you think silverlight should be able to identify its host and then possibly, enable the use of other OS specific features like DirectX in question.

True we can build WPF-directX styled apps, but i still see the motivation for silverlight to take advantage of existing powerful host specific features like DirectX on windosws.

Case in point: Silverlight-DirectX features in a corporate web portal or bundled in a web application ment for use in a controled (windows environment)

Just a thought.

Regards,

Charles Okwuagwu

Paperless Solutions

Lagos, Nigeria

# re: Building Silverlight Applications using .NET

Monday, July 2, 2007 8:07 PM by dev1l85

Hi Scott

I have been desperately searching for how use the silverlight fullscreen feature in my 4th year web project. My project is a GIS website built in VS2005 and i wish to integrate a button onto the masterpage allowing the user to turn the entire page into fullscreen mode. Is there a way to integrate this silverlight fullscreen feature into my VS2005 web project. Thank you kindly for any assistance in this regard.

Devin

# re: Building Silverlight Applications using .NET

Wednesday, July 4, 2007 4:26 PM by ScottGu

Hi Dev,

Here is a blog post I've done that covers moving into full screen mode: weblogs.asp.net/.../tip-trick-supporting-full-screen-mode-with-silverlight.aspx

Hope this helps,

Scott

# re: Building Silverlight Applications using .NET

Wednesday, July 4, 2007 4:26 PM by ScottGu

Hi Sailung,

The best bet for this question is to post on the forums on http://www.silverlight.net.  There are a bunch of experts there who should be able to help.

Thanks,

Scott

# re: Building Silverlight Applications using .NET

Thursday, July 12, 2007 6:06 AM by Steve Wilkinson

Hi Scott,

I've seen a number of posts where people are asking if there will be Webcam support within Silverlight, but I have yet to see an official MS response.

Is there any print support (now or planned) within Silverlight ?

Thanks

Steve

# re: Building Silverlight Applications using .NET

Thursday, July 12, 2007 11:01 AM by ScottGu

Hi Steve,

Webcam support is not supported in Silverlight 1.0 or 1.1 today.  It won't be added to 1.0 before it ships this summer.  We will support it at somepoint in the future though.

Hope this helps,

Scott

# re: Building Silverlight Applications using .NET

Tuesday, July 17, 2007 1:50 PM by EricLaw

Typo on slide 65 of "Building Silverlight applications using .NET"... "available" is spelled "availble".

# re: Building Silverlight Applications using .NET

Friday, July 27, 2007 12:30 AM by William A Phillips

Where do you find installation tips for adding Expression Blend to Orcas. I have both installed and added Expression Blend as a tool to Orcas. I saw your demo video where you right clicked on the Silverlight xaml file to execute Expression Blend from Orcas. I don't have that. I have to use the Tool drop down. When I try to enter Expression Blend and load the project it says invalid xaml file. "<Canvas" not defined in namspace https:\\schemas.microsoft.com\client\2007. Same with "<TextBlock".

Then re-entering Orcas it says it can't open project. I put the xml from the readme file in the expression blend directory.

Otherwise looks like an exciting tool.

# re: Building Silverlight Applications using .NET

Saturday, August 11, 2007 1:14 PM by Mike Kelly

Trying to get the samples working with the Silverlight v1.1 Alpha release and Visual Studio 2008 "Orcas" Beta 2, I found that I needed to open the web.config in the samples Web Application project and change all the versions for .NET assemblies from 2.0.0.0 to 3.5.0.0 - this is apparently because Orcas includes the .NET 3.5 beta framework.  If I didn't do that, I got a missing reference to System.Web.Extensions when I tried to run the samples web app.  Hope this helps others.