Jesse Liberty - Silverlight Geek

By, For and About Silverlight Developers

March 2008 - Posts

Not New, Not Original and Not On Topic

Since I'm about to climb on a plane and leave for VS Live, I thought I'd leave you with one of my favorites from the Internet, on the importance of correct punctuation:

Dear John:

I want a man who knows what love is all about. You are generous, kind, thoughtful. People who are not like you admit to being useless and inferior. You have ruined me for other men. I yearn for you. I have no feelings whatsoever when we're apart. I can be forever happy--will you let me be yours?

Gloria

Dear John:

I want a man who knows what love is. All about you are generous, kind, thoughtful people, who are not like you. Admit to being useless and inferior. You have ruined me. For other men, I yearn. For you, I have no feelings whatsoever. When we're apart, I can be forever happy. Will you let me be?

Yours, Gloria

Tip of the Day Meets the Micro-blog

The Silverlight MicroBlog and Tip of the Day...

Every day I'll publish a very short tip and to do so, I will depend heavily on contributions from Microsoft Employees and members of the Development community and readers of the blog.

 Starting immediately,  please send your MicroBlog Contributions to jliberty@Microsoft.com as follows:

1. The Subject Line should be Tip of the Day

2. The Text for publication should be no more than 130 characters (including punctuation and spaces.) Plain text.

3. Please append your 2-4 character alphanumeric  signature (initials or whatever you like). I reserve the right to append numerals to disambiguate duplicates.

4. If you want public credit, please add a line at the bottom to the effect "You may match this signature to my name John Doe" -- if that line is present, I will update this blog entry with the name you send if/when I use your contribution (see below)

Thus,  a typical email contribution might look like this:

To jliberty@microsoft.com
From: alex@alexHorovitz.com
Subject: Tip of the Day

Use the VerticalAlignment property to make your controls align within a grid's rows. - AAH
You may match AAH to Alex Horovitz.

What would be published in the Microblog would be

Use the VerticalAlignment property to make your controls align within a grid's rows. AAH

At the bottom of this page would be

Initials To Names
AAH = Alex Horovitz

Hope that is clear, and I look forward to your contributions. Let's give this a couple months  and see if it is useful.

Thanks.


Attributions  (alphabetical)

Initials Name
JL Jesse Liberty
JRS John Stockton
@PB Peter Bloss
TBJ Tim Binkley-Jones

 

Get Started Programming With Silverlight 2

I was asked to post this one more time...

Useful tips

  • Memorize this URL: http://silverlight.net - from there you can always find everything you need, including all the tools, tutorials, quick starts, videos, discussions, forums, demo programs, and much more
  • Ignore and do not use anything marked Silverlight 1.1 - there are only two versions you care about as of now: Silverlight 1.0 (our release version) and Silverlight 2.0 (currently in Beta).

How to Get Started

1. Navigate to Silverlight.net (did you memorize that URL?) and click on Get Started on the standard menu,

 GetStarted

Follow that by clicking on View Other Versions,

OtherVersions

That will bring you to a link to the Silverlight 2 Beta 1 Runtimes. Click on that link.

LinkToBeta

This will bring you to the installation files for Silverlight 2

Install Files

Install the Silverlight runtime and when installed look in the upper right hand corner where you will want to click on Tools,

Tools

That will bring you to a page full of tools. I've isolated the essential tools that you'll want to download or follow the links to in the next image,

Tools2

Note that this is not how the page appears; I've removed the inessential links and I'm showing only the ones you'll want to get started developing with Silverlight 2.

Getting Started Learning To Code Silverlight Applications

There is a lot of information available for learning to code in Silverlight. Of course, I'll start by recommending that you read through the available Silverlight 2 Tutorials (I'll be adding a new tutorial twice each month) and watching the Silverlight 2 videos 

SL2Video

and then finally, I'd return to the Learn page and work through any material related to Silverlight 2.

Learn 

ForumsDon't forget about our Forums which are a great place to ask (and answer!) questions from other Silverlight programmers and Microsoft developers.

Be sure to check (or better, subscribe to!) the blogs (under Community)

Blogs

That will make for a good start, and remember that lots of folks are adding new material every day; I personally will be adding two tutorials, half a dozen videos, a web cast and a couple dozen blog entries every month. So you'll want to stop by pretty often to keep up to date.

Error with Cross Domain Web Services

Today I received an email about numerous unanswered questions on the forums about errors when trying to retrieve data from web services that are not on the same server as the one serving the Silverlight application (Cross-Domain).

ActiveForumPosts

I have a tutorial about to be released (today?) that deals with every aspect of this except the one that is causing the problem: cross domain, but that is okay, because it brings everyone to the same starting point.

Unfortunately, I am also going away for a week: to present on Silverlight at VS Live San Francisco and then to Redmond. But that is good too, because if the problem is not resolved by the time I hit Redmond, I'm seeing just the right people to ask.

In the meantime I'll post the question to an internal newsgroup and let you know if I receive any word. Look for further posting no later than a fortnight, but almost certainly sooner.

Thanks!

LINQ To SQL

A number of folk have written to me in response to my 3rd tutorial asking that I spend some time focusing on how to obtain data from a SQL database. This is the topic for tutorial #4, to be released on April 1.

A few interesting issues arose when writing that tutorial, and so I thought I'd start to discuss them even before the tutorial appears.

Architecture

The most straightforward way to deal with using Silverlight to present data from a Database is to create a Web Service whose job is to query the database in response to data coming from Silverlight and to return data in a form that your Silverlight application can use.

Thus, the various skills that the tutorial must bring together include

  1. Creating a simple WCF Web Service
  2. Using LINQ to Sql to create the Queries
  3. Making sure the class is serializable
  4. Creating the Service
  5. Modifying the contract
  6. Implementing the contract
  7. Freezing the port
  8. Setting the Silverlight App to see the Web Service
  9. Calling a method in the service and getting back data
  10. Displaying the data
  11. Adding a DataGrid
  12. Understanding DataGrid properties
  13. Binding data to DataGrids

While all of this is covered in the tutorial, there is plenty to dive into further, and I'll be doing so in this blog over the next few weeks.

Using LINQ to Retrieve Data

The tutorial assumes that you are somewhat familiar with LINQ. This new and powerful aspect of VB and C# is likely to be central to any Silverlight applications that interact with data, and you will want to take the time to learn about it (sooner or later). A good way to start is with ScottGu's tutorial - if you find you want more you might want to take a look at a good tutorial on VB 9 or on C# 3 (see some suggested titles at the bottom of this entry)

Source Code

To get started, open a new project of type WPF Application (!) -- We're going to do this in WPF to avoid dealing with web services for now. The point of this entry is just to look at the LINQ part.

JustLinq

Visual Studio will set up your WPF application (look familiar? Isn't it cool how close WPF and Silverlight are? Don't get distracted! Pay attention in class!)

Right click on the project and choose Add... When the Add New Item window opens, curse (again) that the Templates are not in alphabetical order and click on Linq To SQL Classes. Accept the default name (DataClasses1.dbml) and click Add. That will add DataClasses1.dbml to your project and open the Object Relational Designer  which is just too cool a name.

Open your Server explorer and create a connection to your favorite test database (which in my case is AdventureWorksLT (and I used to know why I preferred the LT version!) and open the tables and drag one (I use Customers) onto the design surface).

DraggingCustomers

When you drop the customers table onto the Object Relational Designer surface a class is created for you in your project. Very cool.

Create the UI

To get all this working, we'll create the same UI in WPF that we'll later create for Silverlight. Simple, ugly, but workable. Open Window1.xaml and notice the grid. To save time, I'll just replace that with the grid from my Silverlight project (!)

Grid

It all just works. Nice.  Notice that we've added three controls in the stack panel: a prompt, a text box and a button. The user enters text and presses the button and we search based on the text. All we need is a way to display the results.

WPF doesn't have a DataGrid so let's throw in a simple ListView. Since this is a Silverlight site and not a WPF site, let's use the code right out of the documentation to show a few columns from the customer table,

ListView

What is missing from this ListView is an ItemSource property -- the source that will serve for the bindings. That will be added dynamically based on the user's input.

Event Handlers

Setting up the event handlers in WPF is exactly like setting them up in Silverlight; which makes this very easy. I've added a Loaded event and an event for clicking on the Search button.

EventHandlers

The job of Search_Click is to gather the data entered by the user and create a LINQ statement that searches the Customers table for any customer whose name begins with the letters entered and return a list of those records, which can be used as the source for our ListView,

LinqStatements

We begin by getting a reference to the Linq classes created earlier. We then create a standard LINQ query passing in the text from the LastName control and receiving the results into a type-safe object marked var. This is an extension of C# 3.0 and will hold an inferred type of IEnumerable<Customer> which is exactly what is needed by the ItemSource property of the CustList ListView.

The user enters all or part of a last name, clicks the button, the LINQ query is executed and the results are displayed in the ListView,

ProgramRunning

Resources for Learning Linq

Programming C# 3.0 (Programming)
by Jesse Liberty, Donald Xie

Read more about this title...
C# 3.0 Programming Language,The: The Annotated Edition (3rd Edition) (Microsoft .NET Development Series)
by Anders Hejlsberg, Mads Torgersen, Scott Wiltamuth, Peter Golde

Read more about this title...
Pro C# with .NET 3.0, Special Edition (Pro)
by Andrew Troelsen

Read more about this title...
C# 3.0 in a Nutshell: A Desktop Quick Reference (In a Nutshell (O'Reilly))
by Joseph Albahari, Ben Albahari

Read more about this title...
Microsoft Visual Basic 2008 Step by Step
by Michael Halvorson

Read more about this title...
Visual Basic 2008 Programmer's Reference (Programmer to Programmer)
by Rod Stephens

Read more about this title...
What I'm Thinking About April

I've been getting a lot of mail on the lines of "When will we have Beta 2?" or "what is the release date for Silverlight" and since I can't answer those questions, and since I know that folks need to plan, I thought I'd tell you what I can know (at least to some degree) and that is what I hope and plan to do in the next six weeks in terms of producing learning material for Silverlight 2 Beta 1. So, very briefly, here are my plans for through the end of April (just in case you are interested).

1. The first week in April I'll be presenting at VS Live San Francisco. Two presentations:

  • Introduction to Silverlight 2 Programming
  • Silverlight 2 Data Binding

I'll also try to attend the Birds of a feather lunch on Tuesday. Once these presentations are complete, I will post them here for your use and / or feedback.

Presentations

According to one of the more useful new sites, Tripit, I'll be flying from SF to Redmond late Wednesday afternoon, and spending the rest of the week talking with the team about Silverlight 2 and trying to uncover what it is I don't know that I don't know.

Webcasts

The first of the Silverlight 2 Webcasts  - Live From Redmond (not) Silverlight 2 and  Event Handling.

How Do I Videos

Plans for Videos in April include (among other things) interacting with databases, web services and XML, Streaming, Deep Zoom (with Dave Isbitski) and more.

Tutorials

I hope to release two tutorials in April, and as noted previously, I plan to take them out of order, that is to say tackling some advanced topics even before covering all the more introductory topics.

Upcoming tutorials might include topics such as

  • Data Templates
  • Linq and Databases
  • Networking
  • Custom Controls
  • Dependency Properties
  • Data Binding and Databases
  • Data Binding and Web Services
  • Transforms and Animation
  • Isolated Storage
  • Advanced Templates and Parts
  • Graphics
  • Animation
  • Interacting with HTML
  • Interacting with ASP.NET / AJAX

Note that I've listed 7 months of tutorials off the top of my head, so take this list as brainstorming, not as a plan. This is the opposite of announcing only when you "know" -- and is more like "here's a peek into the chaos of my thinking"

Programming Silverlight 2 - Table Of Contents

My goal is to have a first draft of the Table of Contents for Programming Silverlight 2 (O'Reilly Media) which I will post here in case you find it interesting and to get your feedback if you would like to participate.  There may be some areas blacked out due to unannounced features.

More soon.

Back up your code!

In 1993 I was given this brilliant cartoon - and I'd love to find out who created it...

Best Personal/ Small Business Offsite Solution I've Found

While I have you, one of the better, less expensive solutions I've found for solving my own off-site backups (after struggling for years) is to use Carbonite, which works silently and effortlessly on files or folders in the background at a tiny fraction of the cost of most off-site services. The downside? They don't version your files. The solution? Have them back up your versioning database! It is amazingly easy to set up, to maintain, to use, and absurdly inexpensive ($50 for one year, unlimited data!)
[This opinion is my own, does not express that of anyone else, lest of all any of my employers or publishers, I have no affiliation with the people who make carbonite, your mileage may vary, contents are hot, void where prohibited, the superman underwear will not make you fly, do not use hot irons on clothing you are wearing)

Uncertainty

Finally, while I'm totally off topic, I have to offer this as told to me by my 12 year old daughter....

Werner Heisenberg is pulled over by the state police who demand his driver's license. The cop asks him "Do you know how fast you were going?"

 "No," says professor Heisenberg," but I know exactly where I am."

Will Silverlight Controls Become More WPF Like - A Personal Opinion

I was told when I joined Microsoft that I no longer had personal opinions about matters having to do with Microsoft software, and certainly not about Silverlight. As a "Blue Badge" I'm just exposed to too much confidential information to be seen as offering informal speculation or personal opinions, or so they said.

It might even be true; who can really keep straight what you hear in back channels and what you hear inside your head (you don't hear little voices in your head? How do you get any work done?).

About a week ago a very smart fellow wrote to me asking for a list of the differences between Silverlight and WPF. I responded saying that I didn't think such a list existed and (I added) "the list is shrinking all the time." He immediately picked up on that and asked me if I was hinting that there is a plan to make Silverlight 2 considerably more like WPF.

Answer: I don't know. And I wouldn't say (we really are careful about not announcing features until they're cooked).

But let me step away from what I do know and put on my rational individual non-employee hat and observe (keeping in mind how often I've been wrong over the past 2 decades!)....

Silverlight was originally named WPF/E. The Silverlight controls are clearly and markedly very similar to and almost a subset of the WPF controls and Silverlight itself is very similar to and almost a proper subset of WPF - so much so that you can take a Silverlight application and plop it into a WPF application and it works (or it does after some tinkering; or it does after a lot of tinkering depending on how you wrote it and how late it is). So we can't be that far. It is just that some things don't work quite the way you expect.

For example, I blogged earlier about the fact that click events don't bubble. I sorta' kinda' understand why not, but they don't in Silverlight and they do in WPF. Will that change? Will they, eventually bubble in Silverlight? I don't know.

But again, let's think about the pressures on the programmers logically.

Here are these guys who built the Silverlight controls (e.g., the button) who are incredibly and justifiably proud of what they've wrought. They use the controls themselves. They also read the email from customers and from WPF programmers and from others, many of whom are confused by (or outraged by, or annoyed by, or mildly bemused by) the differences between Silverlight and WPF behavior.

I'm guessing they'd like the Silverlight click event to behave the same as the WPF click event. Either they think the Silverlight way is the right way for it to behave and they're in the offices of the WPF-control programmers banging on the desk trying to get them to change, or they are now looking again, perhaps banging on their own boss's desk (or on their own heads).

Now, again I don't know but I'm guessing that there are competing pressures. Two I can think of are money and time. After all, you don't just fix the button; you gotta fix all the controls. And you don't just fix Click, you gotta' fix the way all the events work; either you decide to match the routed event handling in WPF exactly or you decide on a different compromise.

Next, there's lots of other features waiting to be added.  And, of course, there are lots of other cool products waiting to be built. And, oh yeah, some developers are still being hired, some are being promoted, some are taking new jobs.... so there are pressures to move on and let things be.

Now, I don't know, but experience suggests that Microsoft has typically placed high value on (a) customer satisfaction and (b) developer respect and (c) common code and (d) not looking stupid.  So if I were a betting man, I'd bet that one day ASP.NET and WPF and Silverlight will all use code (mostly?) in common. On the other hand, I'm not sure I'd bet that we'd get there before all three technologies were supplanted by new and better technologies; which is one of the great pleasures of living in a world of rapid change.

But I don't know and I couldn't say if I did.

More on Routing and Bubbling

One of the readers of my earlier post on routing and bubbling was left confused about when events are bubbled and when they are not.

The documentation is clearer about this in some places than in others. For example, the Mouse events documentation has this to say:

MouseEventsAndBubbling

There are two things to notice here. One is that this particular documentation does clearly distinguish those events that bubble from those that do not.

The second is that the first sentence unfortunately seems to equate being a routed event with bubbling. What I think it means to say is "are routed events that bubble" 

The documentation shows that MouseEnter (which does not bubble) is an event of type MouseEventHandler

MouseEnterEvent

and MouseEventHandler is a delegate for three non bubbling events:

MouseEventHandler

So.... we can safely conclude that

  • All bubbling events are routed events but
  • Not all routed events bubble

( All C# Programmers are human, but not all humans are C# Programmers * )

So which events Do and Do Not Bubble and Why?

One rule seems to be that any event specific to a control does not bubble. That means that Button.Click and Slider.ValueChanged do not bubble.

Wait a minute! What would it mean for Slider.ValueChanged to bubble? Where would it bubble to? What could contain a slider that could possibly do anything with the ValueChanged event?  Clearly that event needs to go to the Slider and nowhere else.

Okay, what about a ListBox which has SelectionChanged. Where should that bubble to?

We're beginning to see the pattern. Most of the time, it doesn't make sense for the events specific to a given control to bubble.

(Clearly not all of the time - Click is a good example where you might want a control event to bubble,  but you can work around that as we did in the previous example with mouse up.)

In WPF you can decide because there are three types of Routed Events (Bubbling, Direct and Tunneling). In Silverlight, for Beta 1 at least, what has been put in place is that control-specific events do not bubble and what does bubble is many (though not all) of the more fundamental events  such as MouseDown/Up/Move,  which lets you get what you want, though not always as elegantly.

One of the other comments was that this "must be fixed."  I'll post my own speculations on that tomorrow, but whether or not this is changed, a few things are becoming clearer:

  • It is possible to accomplish all the event handling you might want as implemented
  • There certainly will be some confusion for WPF programmers who have a superset of the capabilities of Silverlight
  • We need to get our terminology straight and consistent

I hope this clarifies any remaining areas of confusion but if not, please do leave more comments and we'll see if we can't sort it out.

Thanks!

-jesse

* - Yes, yes, some computers no doubt write C# programs and I bet you've met some C# programmers about whom you've had your doubts.

Innovation, Renovation and Change

 

So, after some minutes of trying this and that, it is time to take stock and see what's working and what isn't. 

What's changing...

Tip of the Day: RIP

The Tip of the Day was a great idea, but I have yet to figure out what is the difference between a Tip of the Day and a blog entry, and I think it is causing more confusion than help, so I hereby kill it, put a stake through its heart, put a fork in it, bury it, liquidate it, drop a house on it. may it rest in peace.

But only in name.  I still intend to post at least 5 days a week with substantive tips, follow ups, explorations of issues, and all the material I'd have put into a Tip of the Day; I'll just call them.... er... blog posts; like every body else.

 

The Micro Blog

If I have your permission to stop experiments (like Tip of the Day) then I can experiment with truly wacky ideas. One, which was suggested to me in passing, I want to start right away: the Silverlight Microblog. 

This is the idea of a blog that posts very frequently but only a line or two, and posts through Twitter. It is not a "here's what I'm doing" or even a "look here" reference to a bigger post somewhere else. Rather it is a complete blog entry in the 140 characters you are given.  This will take some practice.

The Twitter account is SLMicroBlog and here's the first posting

SLMicroblog

What needs clarification....

Tutorials: Not in Order

The tutorials have been met with some enthusiasm, though it would be great to get more feedback and I invite you to send me email (jliberty@microsoft.com) or to post comments here. We're working on a way for you to post comments to the tutorials themselves.

In any case, it is not my intention to write the tutorials in "order" -- I'm very aware that some folks would like to get to more advanced topics; though I do think it makes sense to go through most of the material at this level of depth before doing deep dives in the tutorials. 

In addition, Scott Guthrie and I have agreed that the tutorials will be supplemented by the book I'm writing with Tim Heuer for O'Reilly (Programming Silverlight 2) which will provide more depth. Of course the book will be static, so after it publishes I'll continue to write tutorial pieces here as changes and new features emerge.

Videos: Focus on:  Data and a mix of Intro and Advanced Topics

Much like with the tutorials; it is my intention to move quickly back and forth between introductory and more advanced topics. In the next few weeks look for a series of tutorials on event handling (see today's, it turns out last!) Tip of the Day for a look at one topic on event handling. ).  In addition I have a great video coming up working with Dan Isbitski on Deep Zoom which is truly wicked cool.

In the face of a series of requests, I will, however, focus over the next two weeks on making sure to include the following topics among the others I'll be filming:

  • Binding Controls using LINQ to SQL
  • Binding Controls using Linq to XML
  • Binding Controls to data through a Web Service using WCF

I'll also be looking at putting together some videos on using Expression Blend as a design surface for programmers -- that is taking our designer tool and using it from a developers point of view.

Tip of the Day: Routed Events - Bubbling and not...

In Silverlight 2 Beta 1 some events bubble, and some do not. This can cause a bit of confusion, especially because the way this distinction is explained is itself confusing.

Bubbling

To set the stage, let's examine the following simple event handling program which is extracted from my forthcoming video on Event handling (Parts 1 and 2) that will be posted to our Silverlight 2 video page.

The example I'll be using is stripped down into a new application available here: TestRoutedEventsAndBubbling.zip

Keeping The Example Simple

To paraphrase A.E., an example should be as simple as possible, but no simpler.

This example requires a control (in this case a button) whose content is not text, but rather other controls. These concepts are covered in the first two tutorials on Silverlight 2.

We start by creating a new project and within that project a grid. The central control is a button whose Content is itself a StackPanel that contains 4 CheckBoxes

CheckBoxButton

The XAML for this is pretty straight forward and walked through in both the tutorials and the video,

ComplexButton

Notice in the XAML that we are looking at a single button that has a single content consisting of a stack panel within which are declared the four check boxes.

The question is this: when you click on the check boxes, will the button be clicked?

The answer is: it depends.  If you wire this up with a click event it will not bubble. Let's prove that.

ClickEvent

This code adds a Click Event to the button. Sure enough, if you click anywhere on the button except the check box, the button is clicked as reflected in the count in the text box, but if you click in the check box, the check box is set or cleared but the count is unaffected.

ButtonWithClickCount

Now, when I check the documentation, I'm left a bit puzzled, after all, it does say that click is a Routed Event,

ClickEventIsRouted

And it does seem to suggested that Routed Events are, well, routed...

RoutedEvent

The key is that there is routing and there is bubbling.

Now, to make this a bit more confusing, you may read an explanation that goes something like this....

"User code cannot created routed events which the Button is doing"

Eh? User code? Button?

The key thing to realize is that from the perspective of the folks who wrote the code handling routing, the Button is user code (!) just like any control you or I would write. A sharp distinction is made between the fundamental events such as MouseLeftButtonDown which is an event on Implement and which does bubble

MouseLeftDown

You can prove this to yourself by modifying your code only slightly. Comment out the click event and replace it with a MouseLeftButtonUp event handler

MouseLeftButtonUpEvent

When you run it now, it works just as before except that clicking the check box also clicks the button.

Tip of the Day - What to Expect in Silverlight Help

[Updated 3/20 to fix the RSS links] Yes

 I've received a lot of very positive feedback from the tutorials and videos and a lot of inquiries about what help will be forthcoming and how to get help right away. I thought I'd take a few minutes to provide some guidelines that are intended to optimize your experience, not to restrict your access...

First, lots of folks are producing material, both on a regular and on an ad-hoc basis. If you are creating Silverlight 2 applications, I recommend subscribing to

RSS

Silverlight Community Blogs

RSS

Silverlight Geek Blog  (yah, that's me)

addtomyyahoo4Subscribe in NewsGator OnlineAdd to My AOL Subscribe with BloglinesAdd to netvibes   (these are me too Wink )

Tutorials

As noted previously, the tutorials will be released at least twice monthly, beginning the end of this month, and my plan is to go through all of Silverlight 2 at an intermediate level.

Videos

The videos will not be released in "order" -- that is to say the goal of the videos is for them to stand independently, allowing developers to dip into topics of interest. The first few will cover the basics, but after that I will be moving freely among elementary topics, intermediate and advanced topics. 

Tips of the Day

The tips of the day will range in size from one liners to full explorations of coding issues (with code examples attached) - often diving deeper into issues covered in the videos or the tutorials

Blog Entries

My blog entries will attempt to fill in the gaps, add a bit of a look behind the scenes and maintain some continuity in the story

Web Casts

The web casts will be a combination of deep dives and real-time HDI (How Do I) videos. The tentative schedule (soon to be finalized) looks like this:

Date Topic
4/16 Controls and event handling
5/21 Data Binding/Routed Events
6/18 Styles, Templates and more
7/16 Deep Zoom

Looking for Help

The best place to get the fastest answers is on the forum -- though I admit some questions slip through the cracks.  But the forums is where everyone looks first and if your question is unanswered for a while, post a follow up. The tricks to getting a fast answer include:

a. Use a good subject that summarizes the problem so the folks who might know the answer stop and read the question. Good subject: "Urgent: Crashes when two buttons in same stack panel" - Bad subject "Help!!!!"

b. Give as much information in as few words as possible - tell more, not less, but shorter paragraphs are easier to read, and put the important information up front; write like you're a journalist, not a novelist.

c. Be very specific about versions and environment as possible - tell us how to reproduce the problem.

Writing to Me

You are always free to write to me and I love getting suggestions for improving my videos, tutorials, tips, blog entries as well as general complaints, praise, etc.   (Note, you can also leave comments about videos right on the landing page for the video, which is great!)

Writing to me with specific "I can't get this to work" questions will generally get a response pointing out that you'll get a faster answer on the forum, unless you are talking about an example I wrote, in which case, please do write as I'll want to fix it right away. (Unless it is 1.1, in which case, ahhh., welll.... sorry, Mr. Liberty is out, please leave a message...)

Writing to me asking when Silverlight will be released will get my standard "We've not released a date for that yet, though we are aware of how important it is for the community to know as soon as we possibly can tell you."

Dropping By My Office In Redmond

Since so many have asked, nope, I'm not in Redmond (though I visit a lot!). I work from my home in the suburbs of Cambridge MA. 

Reaching Me

The best way to reach me is via email, but there are dozens of other ways, including my blog and my personal portal.

Tip of the Day Release Schedule and Time

Tip of the Day will be released every day by 13:00 UTC-5 (Eastern) except when it isn't.

Tip of the Day: Getting Started With Silverlight 2

A number of folks have asked me for a step by step set guide to getting started programming with Silverlight 2. Here it is.

Useful tips

  • Memorize this URL: http://silverlight.net - from there you can always find everything you need, including all the tools, tutorials, quick starts, videos, discussions, forums, demo programs, and much more
  • Ignore and do not use anything marked Silverlight 1.1 - there are only two versions you care about as of now: Silverlight 1.0 (our release version) and Silverlight 2.0 (currently in Beta).

How to Get Started

1. Navigate to Silverlight.net (did you memorize that URL?) and click on Silverlight 2 Beta 1 Now Available!

News

 

If that link has scrolled off the news you can start by clicking on Get Started on the standard menu,

 GetStarted

 

If you click on Get Started follow that by clicking on View Other Versions,

OtherVersions

That will bring you to a link to the Silverlight 2 Beta 1 Runtimes. Click on that link.

LinkToBeta

 

These three steps from the standard menu will bring you to the same page as the one step from news,

Install Files

 

Install the Silverlight runtime and when installed look in the upper right hand corner where you will want to click on Tools,

Tools

That will bring you to a page full of tools. I've isolated the essential tools that you'll want to download or follow the links to in the next image,

Tools2

Note that this is not how the page appears; I've removed the inessential links and I'm showing only the ones you'll want to get started developing with Silverlight 2.

 

Getting Started Learning To Code Silverlight Applications

There is a lot of information available for learning to code in Silverlight. Of course, I'll start by recommending that you read through the available Silverlight 2 Tutorials (I'll be adding a new tutorial twice each month) and watching the Silverlight 2 videos 

 

SL2Video

 

and then finally, I'd return to the Learn page and work through any material related to Silverlight 2.

Learn 

ForumsDon't forget about our Forums which are a great place to ask (and answer!) questions from other Silverlight programmers and Microsoft developers.

 

 

 

Be sure to check (or better, subscribe to!) the blogs (under Community)

 

Blogs

 

That will make for a good start, and remember that lots of folks are adding new material every day; I personally will be adding two tutorials, half a dozen videos, a web cast and a couple dozen blog entries every month. So you'll want to stop by pretty often to keep up to date.

How do I Write that In JavaScript?

A comment was left in response to Master Detail in Silverlight 2 asking "Any hint how to create such a sample with Java Script instead C#?"

I thought the answer was important enough to post to the blog in general...

MultiLanguageTwo points about your question. The first is whether you are asking if one can write this same program in JavaScript in Silverlight 2 (answer: yes) or you are asking if one can write the same program in Silverlight 1.0 (which only uses Javascript) (answer: depends).

Second point is that there are a number of languages that SL2 supports: IronRuby, JavaScript, VB, C#, etc., and (frankly) it won't be possible for me to illustrate all of them (or even most of them) in these examples, but it shouldn't be terribly hard to translate the logic from one language to another because the code is pretty simple and the Silverlight documentation shows the syntax for each event, method and property in the various languages.

While it is true that Silverlight 2 supports JavaScript, it is also true that C# supports language features that simply are not available in Javascript such as generics (ListOf<Books>) and true classes and objects. Translating my examples from C# to (e.g.,) VB is trivial, but translating to JavaScript is more of a challenge.

Which brings me to my final point, which is that I honestly can't imagine why you'd want to do this in Javascript; the code will be slower, harder to maintain and harder to create.

If you'll pardon what may sound rude and even arrogant, I think you'll be a lot happier if you take the opportunity to "step up" to managed code (see, for example, Programming C# 3.0, 5th Edition by my favorite author) which will not only enhance your Silverlight experience, but will bring you nicely into the entire spectrum of .NET programming from ASP.NET, ASP.NET/AJAX through WPF, WCF, Workflow, etc.

Programming C# 3.0 (Programming)
by Jesse Liberty, Donald Xie

Read more about this title...

You'll love it. I tried it in 2000 and never looked back.

 

 

 

 

 

 

 

Source for the Tip of the Day

The Tip of the Day occasionally will delve deep into code (other days it will just provide a bit of useful information, or a tip, etc.)

When code is examined, however, I'll try to provide a complete working example, and to get us started, I've gone backwards in time and added links to complete sample applications for

Master Detail in Silverlight 2 (3/15)

Content - It Ain't Just Text (3/11)

Routed Events (3/10)

 

Each article now begins with a nice big link to the source code.

 SourceCode

The source code should run well with the Beta 1 of Silverlight, but if you encounter any difficulties, please do let us know.

Just for the record, every example is tested on the public release of Visual Studio 2008 and the public release version of Silverlight 2 Beta 1.

Next