I have received a number of emails asking when Silverlight will ship; and I’ve promised to look into it for a number of folks who very much need to know. Here is what I found out…
While the incredible success of the use of Silverlight in facilitating the viewing of the Olympics and the Democratic convention speak to the solidity of Silverlight 2 and to the very high standards we’ve set, we’re not quite ready to make any announcements. (sorry).
Please be assured that we totally understand how much you need to know the date, but as has been true all along, when we announce a date we want it to be a date you can count on, and we are working hard on getting you that date as soon as we possibly can.
Where Has Liberty Gone?
While I have you, let me apologize for the recent slow down in information coming from Liberty Central. I was on vacation for much of August (and, as many of you know, dealing with family “stuff”) and I’ll be “out of office” for much of September: I’m in Redmond this week, and will be in the UK from the 14th to the 25th (Remix, Bristol, Dublin and Ulster).
Once I return, I hope to ramp up a significant set of more advanced videos, supplemented by tutorials, web-casts, and blog posts, and then venture into a couple new approaches. The goal will be to meet the needs of those of you who want to go beyond the fundamentals, while still ensuring that the “on ramps” to Silverlight are kept in good condition as programmers arrive. I have a long list of advanced topics from your suggestions and from talking with folks here, and Tim and I are looking at a lot of cool ways to get that information out.
In the meantime, please be sure to catch my next webcast on September 10: Creating Skinnable Custom Controls.
I had a great time discussing Silverlight with Craig Shoemaker on his PodCast Pixel8.

Craig is a terrific interviewer; well informed, passionate, smart, Microsoft MVP, ASP Insider, developer, podcaster, blogger, co-author of Beginning ASP.NET with AJAX, and very good at letting me blather on and then jumping in to get me back on track.
I highly recommend subscribing both to Pixel8 and to Craig’s independent PolymorphicPodcast
I had a lot of fun in this interview in which we focused in on what’s hot in the Silverlight Developer community; what do folks want to know, how are we going to meet those needs.
I’m very proud and excited to announce that I’ve been invited to be a monthly guest on the Sparkling Client Silverlight Podcast. Details to follow very soon, but our initial shows include a discussion of Templates on September 23rd and of Databinding on October 28.
You can find out more about the show, its hosts and their previous podcasts on the Sparkling Client Home Page.
Due to a family emergency I had to postpone today’s Webcast, and I apologize for the inconvenience. I did want to assure you that we have already rescheduled, that we will record the Webcast, and that I will be recording a series of How Do I videos on custom controls as well.
Thank you for your patience.
I’m very pleased to announce that the Silverlight Tutorials are now available in Japanese with more on the way soon. (All tutorials in VB and C# soon as well)
-Jesse
A personal note on two threads coming together.
In 2004 I watched Senator Barack Obama give the Keynote speech to the Democratic National Convention and two weeks later I placed an Obama for President bumper sticker on my car that generated smiles, “if only…” comments and quite a few chuckles.
In 2007 I attended Mix and within a very short time gave up a dozen years as an independent consultant to join Microsoft as Silverlight Community PM.
This morning, I had the incredible pleasure of watching Obama’s keynote again, this time using Silverlight technology, which as you probably know is the enabling technology for the DNC 08 web site.
Obviously the decision as to who leads our nation is far more important than the decision as to which technology we choose, but participating, in whatever small capacity in both threads, has been (and very much continues to be) a blast.
Back in June I posted a blog entry on how to get started with Silverlight; it seems it is time to update that as the world changes very quickly and we have many new resources. Each of us has our own way of learning, but here is my suggested path through the information, mixing tutorials and videos with a healthy dose of hands on!
Step One – Get Only What You Need At FirstFirst, go to the Get Started page, but don’t download everything in site. There’s always time to come back; start by getting just the links shown here:
Next, Click on Learn on the menu at the top of the page (or click here) and watch or download Video #1, The Silverlight Install Experience.
You’ll want to be sure that you have installed the Silverlight tools for Visual Studio properly, and I would go ahead and install Expression Blend as well.
If you have little .NET experience and no WPF or Silverlight experience, then you may want to pause here and get some basic background. In that case, I suggest (a) Taking a look at some showcase applications to see what Silverlight can do, and then perhaps read through this old, but still useful overview of Silverlight
If you are already a .NET programmer, read (or download) the first Tutorial: Silverlight Controls and be sure to work your way through the programming (source code is available in both C# and VB.NET and the tutorial itself will be in both languages very soon.
Then be sure to watch the following videos on the fundamentals (click on the image to go to the video)
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
| ![]() |
![]() | |
| |
Careful! You’ll want to watch #33 Templates without VSM before you watch #32 Templates and VSM.
Videos and TutorialsThe User Controls tutorial matches up with the Keyboard and the User Control video.
Tutorial 5, Expression Blend for Developers is a solid foundation for the second half of the videos shown that use Blend (starting with Introducing Blend to Silverlight Developers and Intensive Silverlight Programming and Expression Blend)
The Styles and Templates tutorial is a very good match with the two videos on Templates
We have three tutorials on Data:
and these match up well with the many videos on databinding and data manipulation.
Once you’ve worked your way this far, you’ll be all set to explore on your own as you’ll have all the fundamentals under your belt and a bit more.
Enjoy! And don’t forget, the forums are a great place to get your questions answered quickly.
I’m incredibly pleased to say that we have implemented a comments section for each tutorial, just as we do for each video
Please leave your comments and I will subscribe to the comments list and try to respond as quickly as possible (if your comment goes unanswered for a while, don’t hesitate to send me mail: jliberty@microsoft.com
NB: I’ve heard loud and clear that you want to see more advanced topics covered; they are on the way. The current plan calls for a tutorial in September and one in October and then to look at the frequency; either staying at once a month or bumping it up to twice a month. I’m traveling for some of September so will let you know shortly after that.
Thanks!
In much of the writing about animation in Silverlight, one question that seems to recurs is this: why bother with a linear key-frame animation if it is less intuitive and more complex than a simple from-to animation
Let’s back up and examine that for just a second.
Linear InterpolationLinear Interpolation means that if you instruct the animation to start at position 0 and move to position 200 over 4 seconds, then you know that it will be at position 100 at 2 seconds, (half way there in half the time) and at position 50 at 1 second (1/4 of the way in 1/4 of the time) and at position 25 at 1/2 second. That is, the distance is covered evenly over the allotted time.
It turns out that there are two types of animation in Silverlight that use linear interpolation: simple from-to animation, and Linear Keyframe animation.
From-To AnimationFrom-to animation just says “Take this value and change its value from x to y over this much time”. For example, you might write
<DoubleAnimation Storyboard.TargetName=”TT1” Storyboard.TargetProperty=”X”
From=”0” To=”500” Duration=”0:0:2” />
DoubleAnimation means that you’re going to create an animation by changing some value that is expressed as a Double (that is a number that might have a fraction).
The Target is named TT1 (in this case it is a Transform but it could be a shape, etc.) The property on that target is X (in this case the X position in an (X,Y) point. Then you see the From value (0) and the To value (500) and the Duration (2 seconds) which means that you’re going to change that property (x) from 0 to 500 over 2 seconds.
Suppose you want to move a rectangle from the upper left to the lower right of your control, and you’re writing the Xaml by hand. One very easy way to do so is to use From-to animation (specifically, a DoubleAnimation that targets the Rectangle’s TranslateTransform X and Y). You might end up with a Page.xaml that looks like this:
1: <UserControl x:Class="BlogAnimationExample.Page" 2: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4: Width="600" Height="800"> 5: <UserControl.Resources> 6: <Storyboard x:Name="FT1"> 7: <DoubleAnimation 8: Storyboard.TargetName="TT1" 9: Storyboard.TargetProperty="X" 10: From="0" To="500" Duration="0:0:2" /> 11: <DoubleAnimation 12: Storyboard.TargetName="TT1" 13: Storyboard.TargetProperty="Y" 14: From="0" To="700" Duration="0:0:2" /> 15: </Storyboard> 16: 17: </UserControl.Resources> 18: <Grid x:Name="LayoutRoot" Background="White" > 19: <Rectangle x:Name="rect1" 20: HorizontalAlignment="Left" 21: VerticalAlignment="Top" 22: Margin="10,0,0,0" 23: Stroke="#FFFF0000" 24: Width="200" Height="60"> 25: <Rectangle.RenderTransform> 26: <TransformGroup> 27: <TranslateTransform x:Name="TT1" /> 28: </TransformGroup> 29: </Rectangle.RenderTransform> 30: </Rectangle> 31: </Grid> 32: </UserControl>You need something to kick that off, so modify Page.xaml.cs as follows:
1: public Page() 2: { 3: InitializeComponent(); 4: Loaded += new RoutedEventHandler( Page_Loaded ); 5: } 6: 7: void Page_Loaded( object sender, RoutedEventArgs e ) 8: { 9: FT1.Begin(); 10: }Now the animation will begin as soon as the page loads.
Adding a WrinkleThat works fine, but what if instead of having the rectangle drift to the lower right on an angle, what you’d like is for the rectangle to go straight down, then to the right and then return home on the angle?
If you look at our story board you can see that it is combining the first DoubleAnimation that moves to the right with the second animation that moves down to create a single path that moves down and to the right at the same time. What is needed is three story boards!
1: <UserControl.Resources> 2: <Storyboard x:Name="FT1"> 3: <!--Move down--> 4: <DoubleAnimation 5: Storyboard.TargetName="TT1" 6: Storyboard.TargetProperty="Y" 7: From="0" To="700" Duration="0:0:2" /> 8: </Storyboard> 9: <Storyboard x:Name="FT2"> 10: <!--Move right--> 11: <DoubleAnimation 12: Storyboard.TargetName="TT1" 13: Storyboard.TargetProperty="X" 14: From="0" To="500" Duration="0:0:2" /> 15: </Storyboard> 16: <Storyboard x:Name="FT3"> 17: <!--Move home--> 18: <DoubleAnimation 19: Storyboard.TargetName="TT1" 20: Storyboard.TargetProperty="X" 21: From="500" To="0" Duration="0:0:2" /> 22: <DoubleAnimation 23: Storyboard.TargetName="TT1" 24: Storyboard.TargetProperty="Y" 25: From="700" To="0" Duration="0:0:2" /> 26: </Storyboard> 27: </UserControl.Resources>The first storyboard moves down (and not to the right), the second moves right, and the third moves both on both the x and y axis to move home. Unfortunately, you’re not done. Because of multi-tasking you can’t just launch these; you have to make sure that FT1 has completed before you start FT2, and that must complete in turn before you launch FT3.
Fortunately, there is a completed event for storyboards, so it isn’t all that difficult:
1: public Page() 2: { 3: InitializeComponent(); 4: Loaded += new RoutedEventHandler( Page_Loaded ); 5: FT1.Completed += new EventHandler( FT1_Completed ); 6: FT2.Completed += new EventHandler( FT2_Completed ); 7: } 8: 9: void FT2_Completed( object sender, EventArgs e ) 10: { 11: FT3.Begin(); 12: } 13: 14: void FT1_Completed( object sender, EventArgs e ) 15: { 16: FT2.Begin(); 17: } 18: 19: void Page_Loaded( object sender, RoutedEventArgs e ) 20: { 21: FT1.Begin(); 22: }It isn’t pretty, but it works.
Using KeyframesKeyframes give you a good bit more control at the cost of a little more complexity. With Keyframes you state a series of time/value pairs.
So rather than just saying here’s my start value and my end value and how much time you have you say at time 0 the value is 0 and at time 1 second it is 120 and at time 1.27 seconds it is 195 and at time 2 seconds it is 400.
You can have as many time elements as you want, and they don’t have to be evenly spaced. While the system will create a linear interpolation between the values you supply, you do not have to space your explicitly named values evenly. So it is perfectly legitimate to tell the shape to move 50 units in the first second, 200 units in the next two seconds and 500 units in the fourth second.
That extra power allows you to solve the problem above with a single storyboard:
1: <UserControl.Resources> 2: <Storyboard x:Name="StoryBoard1" > 3: <DoubleAnimationUsingKeyFrames 4: Storyboard.TargetName="TT1" 5: Storyboard.TargetProperty="X"> 6: <LinearDoubleKeyFrame KeyTime="0:0:0" Value="0" /> 7: <LinearDoubleKeyFrame KeyTime="0:0:2" Value="0" /> 8: <LinearDoubleKeyFrame KeyTime="0:0:4" Value="500" /> 9: <LinearDoubleKeyFrame KeyTime="0:0:6" Value="0" /> 10: </DoubleAnimationUsingKeyFrames> 11: <DoubleAnimationUsingKeyFrames 12: Storyboard.TargetName="TT1" 13: Storyboard.TargetProperty="Y"> 14: <LinearDoubleKeyFrame KeyTime="0:0:0" Value="0" /> 15: <LinearDoubleKeyFrame KeyTime="0:0:2" Value="700" /> 16: <LinearDoubleKeyFrame KeyTime="0:0:4" Value="700" /> 17: <LinearDoubleKeyFrame KeyTime="0:0:6" Value="0" /> 18: </DoubleAnimationUsingKeyFrames> 19: </Storyboard> 20: </UserControl.Resources> 21: <Grid x:Name="LayoutRoot" Background="White" ShowGridLines="false 22: <Rectangle x:Name="rect1" 23: HorizontalAlignment="Left" color: #60I haven’t really written much about transforms in a long while. We looked at them in depth during the Silverlight 1.0 time frame and then more or less took them for granted ever since.
It may be time for a review – perhaps a quick video (it’s on my list!). In the meantime, here’s a quick peak into some of what we say about Transforms in our forthcoming book, [footnote 1]
![]() | Programming Silverlight 2 by Jesse Liberty, Tim Heuer Read more about this title... |
A transform is just an instruction in Xaml to change the object in a particular way, and wouldn’t be interesting, except that you can have that change happen to your object either when that object is in a “state” (e.g., mouseOver) or as part of an animation (“move from here to there and get twice as big over the next 5 seconds”). In that case, the ability to specify all that in Xaml (as opposed to code) really is quite interesting.
Playing With Transforms
To see some of this in action, create a project in Expression Blend and create four rows and 2 columns of approximately equal size (or, if like me, you have OCD, put the design surface in split mode and set the column and row sizes exactly.
Once you’re done admiring your grid, draw a circle in the upper left cell (hold the shift key while you draw an ellipse.) In the properties window set its name to Circle1 and set its Width and Height to 90, its alignments to center and its margins to zero. Fill it with a nice blue. Then make 3 more circles, filling the upper two rows, giving each circle its own color.
Fill the bottom two rows with rectangles sized 120 by 80, also centered in each cell with no margin. Take a moment to name the circles Circle1, Circle2, etc. and the rectangles Rect1, Rect2, etc. and give them each a distinct color.
When you are done, your grid should look more or less like this,
Click on the first circle (you can click on Circle1 in the Objects and Timeline window) and open the Transform tab in the Properties window. Notice that the Transform Window has six tabs, if you hover over each in turn they are identified as
A TranslateTransform moves the object. Set the X value to 225 and the Y value to 125. Suddenly your circle is visiting with the red circle that was down and to the right. You have “translated” its 0,0 position to a new position in the grid.
RotateNo surprise what this does. Click on the rectangle in the lower left corner and then click on the rotate tab. You are prompted to enter an angle; enter the value 45 and watch the rectangle swivel 45 degrees as shown here
As you would expect, scale lets you grow or shrink an object. Let’s set the scale of the green rectangle to 1.5 and of the purple rectangle to .5, and finally, let’s set the yellow rectangle’s X scale to 1.5 and its Y scale to .5. Finally, let’s scale the X and Y of the purple circle up by 1.5 but with the green, let’s scale the X up by 1.5 but leave the Y alone. The result is shown here,
Restore
Before we look at Skew translations we need to restore the circles and rectangles to their original sizes and shapes. To do so, click each shape in turn and then look at the RenderTransform label in the Transform window. You’ll see a small white dot indicating that the object has been transformed. Click on that dot as shown here,
This will bring up the Advanced Property Options Dialog, the first choice of which is Reset; click on this to reset all the transforms for this object. Do this for each of the shapes in turn; they will each be restored to their starting size, shape and orientation.
SkewA skew changes the lines of an objects along its x or y axis and can either distort the apparent slope of an object (e.g., turning a square into a parallelogram) or can even simulate three dimensions.
Replace the rectangles with 80 by 80 squares. Let’s skew the first (left-most) one by setting its X value to 45 and its Center (the next tab to the right) to 0,0.
![]()
![]()
You can combine skewing on one axis with changing the center to give the illusion of an object bisecting the surface of the plane. Click on the middle square and set its Y skew to 45° (thus turning the skewed figure on its side) and also set its center to 0.5, 0.5;
Hope that is helpful
---------------
[footnote 1 – this is just an excerpt from unedited text, placed here not to push the book but to provide what I hope will be helpful information. The book is mentioned only because the material is copyright 2008 O'Reilly Media ]
When I wasn’t looking this Website/Mindware got a lot better. Visual Thesaurus is an on-line subscription tool (~$3/month) that you can also buy as a desktop utility, that allows you to put in a word and see its related words visually. I put in play and got back a blizzard of related words,
(Click on the image to see it full size)
Each node can be clicked on to find out what everything radiating from that node shares in common. For example, travel, locomote, go and move all radiate from a common node. Clicking on that brings up a definition that all four share, and an example sentence,
What relationships are shown in the diagram is dictated by your settings (as is font size, line size and many other aspects of the diagram),
You can see that this goes well beyond just synonyms.
The node colors are keyed to the definition chart (thus, the green that tied together the four words above is listed in the verbs section, and all the verb nodes in the entire diagram are defined there as well.
You can reverse the action and find a definition under verb and that will light up the node and thus show you the words associated with it.
Of course, if you click on a word, that word becomes the focus of a new set of associations, allowing you to progress from Play –> Contend –> Debate –>Argument –>Variable->Symbol to Star…
This can be either incredibly rewarding for your writing, or a tremendous time-sink. But it is wonderfully responsive and great fun.
I admit it, this has little to do with Silverlight per se, but it is such a useful utility, and I use it so much all day (including when I’m programming) that I thought I’d share it with you, at least briefly.
Every time you copy anything to the clip board, it is captured to ClipTrack (though you can create white and black lists to change that behavior). You can find things in chronological order, alphabetical order, by when they were clipped,by when they were pasted, by type (image, text, web, etc.) or you can create folders (favorites, project based, whatever). You can look at web pages in html view, text view or web view, and modify before re-saving or pasting. It just goes on and on.
![]()
Area 1 has the menu (which includes some powerful option settings) and four buttons: add a clip (lets you hand create text to add to the clip board), delete a clip, paste and move (move from one folder to another).
Area 2 is the list of folders – there are pre-designed folders (by date when clipped, by date when pasted, by type (images, text, html, etc.) and also custom folders (favorites, by project, etc.). Below Area 2 in area 5 are buttons to create and delete custom folders.
Area 3 is a list of the clips in the folder you’ve picked. Each title can be changed without changing the clipping and the image to the far left indicates the type of clip.
When you highlight any clip it is displayed in area 8, and can be edited using the tools in area 6. For complex types (e.g., web pages) and you can switch your view from HTML to TExt to Web which is very nice.
Printing
I wrote to the author (Mark Sweeney) and asked for a feature in a future release: take whatever is the current clip and let me print it. What I had in mind was that there are times I want to copy and print something from the web that is not well formatted; I’d rather not have to paste it into a text editor and then print from there. Within a day he added the print button (area 7) that not only has print setup and print preview, but automatically defaults to “shrink to fit printed page” along with a host of other useful features. Truly great.
Please note, while the application is free, it is available through PC Magazine utilities, which is a subscription service.
Full disclosure, I was formerly employed by Ziff Davis, which was at one point the parent company of PC Mag and I was, even earlier than that, the WizOp of the PC Mag BBS but that was long ago and far away.
I’m pleased to announce we’ve posted three new videos:
In the In-State Animation video I show the use of a Content Presenter control to allow the user to dynamically set the content for my round button, and in fact this is what allows me to use one template instead of four in the blog post A Third Way To Handle Templated Buttons and Images but it would be nice to show that technique in a video of its own; so that is on the way. Therefore I’m moving up two videos:
1) How to use a contentPresenter to allow the user to set the content of a templated button and
2) How to use image resources to use one templated button with multiple backgrounds
Now on the top of my to-do list.
-j
In yesterday’s blog post I suggested that there were two solutions to crating a templated button that used an image. One was to create a different template for each image (yuck) and the other was to create a custom temlpated button.
A third, and excellent alternative was suggested to me by email by Justin Angel, and that is to set the images as Resources in Expression Blend. Then, you can add buttons to your pages, and apply the template (which will control such things as how they behavior in response to a mouse over, and you can apply the Resource as a background. Very nice.
Here is how I did it to get the effect I wanted. (NB: this will all be shown in detail in a forthcoming video, and is summarized here very quickly):

Thus I ended up with four resources, each usable as a background.
4. Next I created a single template for my button, but this time instead of making a template from scratch, a made a copy of the existing template. A little spelunking and I was able to discard the cowl that made the background hard to see, and I changed the mouse-over behavior to bounce like a silly Mac-dock entry and I modified the pressed behavior as well.
1: <vsm:VisualState x:Name="MouseOver"> 2: <Storyboard AutoReverse="True" RepeatBehavior="Forever"> 3: 4: <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" 5: Storyboard.TargetName="Background" 6: Storyboard.TargetProperty="(UIElement.RenderTransform). 7: (TransformGroup.Children)[3].(TranslateTransform.Y)"> 8: <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-10"/> 9: <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/> 10: </DoubleAnimationUsingKeyFrames> 11: <!-- you get the idea --> 12: <Storyboard.TargetName="CurvedBevel" 13: <Storyboard.TargetName="Accent" 14: <Storyboard.TargetName="contentPresenter" 15: </Storyboard> 16: </vsm:VisualState>
Finally, I added a stack panel to hold the buttons and added four regular buttons. For each one, I set its background to one of the resources (giving each a nice picture background) and dragged the template on (giving them all the templated changes) and then set the content (which I was able to do because buttons do have a contentPresenter) and the font, font color and font size. The net effect was much cleaner than 4 templats and the only code that had to change at all was rewiring the 4 button event handlers.
A video on all this will be forthcoming as soon as I get back from vacation.
Thanks.
Today I had the pleasure of presenting a web cast on building an application with more than one page and passing data among those pages. I have 2 videos on this topic, so if you missed the web cast and are interested, you may find this first video on switching pages of interest, and the second video should be posted soon.
Multi-Page In A Nutshell
The premise is that there is a third page that has no content and when it is time to display one of your pages, you make the page you want to display (which is, after all, a UserControl) the content of that third page (I’ve chosen to name the third page PageSwitcher but of course you may call it anything you like. PageSwitcher has a method, Navigate that takes a UserControl and makes whatever you pass in, its content. The implementation for the button on each page is to make the page you are switching to the new content.
Passing ValuesBecause we destroy the current page when we replace it (to conserve on client-side resources) if we wish to pass information (such as the book name, authors, whether the book is published and whether or not it is fiction) the easiest way is to make PageSwitcher the temporary repository; and the most efficient way to do that is to overload the navigate method to take an Object so that you may pass in anything at all, and then fish it out when your new page is loaded (very effective, very efficient and not at all type safe!).
To see this at work, assume the user has filled out the fields as shown in Page 1 and clicked switch. The event handler for the button might look a bit like this:
void SwitchButton_Click( object sender, RoutedEventArgs e ) { PageSwitcher ps = this.Parent as PageSwitcher; if ( ps != null ) { Book b = new Book(); b.BookName = BookName.Text; b.Authors = Authors.Text; b.isPublished = IsPublished.IsChecked == true; b.isFiction = Fiction.IsChecked == true; ps.Navigate( new Page2(),b ); }We know that our “parent” is the PageSwitcher as we are its content, and so the cast is safe (but being good o-o programmers we check (Доверяй, но проверяй)
We then spin up a Book instance (defined off camera and fill in the properties from the user-filled in fields and then call the overloaded Navigate method, providing a new instance of Page2 and our newly filled in book.
We trust PageSwitcher to (a) abandon Page.xaml and make Page2 its content and to hold onto whatever we’ve passed it until Page2 asks for it (think Secretkeeper in Harry Potter).
When Page2 is safely established, it asks PageSwitcher if there are any little presents waiting, like this:
void Page2_Loaded( object sender, RoutedEventArgs e ) { PageSwitcher ps = this.Parent as PageSwitcher; if ( ps != null ) { if ( ps.SwitcherTag != null ) { Book b = ps.SwitcherTag as Book; string isPublished = string.Empty; if ( b.isPublished == false) { isPublished = " not "; } string isFiction = b.isFiction ? " is Fiction " : "is non-fiction"; BodyText.Text = "Found " + b.BookName + " written by " + b.Authors + ". The book is " + isPublished + " published and " + isFiction; } SwitchButton.Click += new RoutedEventHandler( SwitchButton_Click ); }That is, if you are my parent (and you are) do you have anything tucked away in your SwitcherTag property. (“Whats it gots in its pocketses?”) If so, I happen to know that it is a really a book object, and it is my book object and gimme.
Now all of that is fine and good but we’ve been here before. One of the viewers asked if I could show how to pick among 4 pages, and by the way could my buttons look cooler. So, instead of working on my chapter, which I really have to do, I spent the past four hours creating a new version that has bouncy buttons with images that take you to four different pages.
It’s wicked easy to do if (and only if) you are willing to make 4 templates. If you want one template, well then my friend you have to figure out how to expose not only the content property that button has, but the image source property that button doesn’t have, and the short answer is you can’t unless you are willing to sub-class, and that means a custom control and that is a lesson for another day (quite soon actually – I have a WebCast coming on that on August 27
So, compromising and creating 4 templated buttons (yuck but what can I say?) I did make them bounce (they look a bit like they want to be on the Mac dock but don’t tell anyone) I do have an application that combines Skinning and multiple pages, and transferring data and in-state animation which I will turn into a video because, frankly, it is too late at night to continue that story here.
But here’s a picture (doesn’t bounce much and the first button is disabled)
Stay tuned for the video walkthrough and then for the real-deal: skinnable custom controls (after which we can re-do this with one template).
thanks again.
-j
PS: the two books shown are highly recommended, but have nothing to do with the topic at hand.
![]() |
Look Both Ways: Bisexual Politics
by Jennifer Baumgardner Read more about this title... |
![]() |
Pillar of Fire : America in the King Years 1963-65 (America in the King Years)
by Taylor Branch Read more about this title... |
A quick note to thank so many of you for your excellent suggestions. The following topics are definitely on my list (though not yet in any particular order) and I have quite a few more to look into:
There were also many requests for “Line of Business” tutorials, but I’ll tell you that I believe others are working that part of the story so I may hold off a bit on that until I know exactly what we’ll have to offer there in the near term.
These are certainly not the only topics I’ll be covering, but it already make for a challenging list. Please feel free to send additional topics via email as they occur to you and don’t forget to keep an eye both on the new videos and on the WebCast schedule.
I can promise no fewer than one substantial tutorial per month; whether it makes sense to increase the frequency is something that I’ll be thinking about quite a bit this summer.
The next phase of my Silverlight Tutorials will concentrate on more advanced topics.
I’d like to invite you to tell me what topics you’d like to see covered; what is most pressing, most confusing or least accessible? Feel free to drop me a note at jliberty@microsoft.com – it may take a while to get to your topic (I may try to wrap it up with others) but I will compile a complete list and try to cover them all.
Thanks!
I recently finished Part 2 of Page Switching in which I demonstrate how to pass parameters between Silverlight pages (this video is in production and should be available soon.)
A reader asked if I could provide the essential information, so here it is, very short, and very terse, I’m afraid.
The trick, such as it is, is to overload the Navigate method in the PageSwitcher user control. Here’s the code from PageSwitcher.xaml.cs
public partial class PageSwitcher : UserControl { public object ObjectValue { get; set; } public PageSwitcher() { ObjectValue = null; InitializeComponent(); if ( this.Content == null ) { this.Content = new Page(); } } public void Navigate( UserControl nextPage ) { this.Content = nextPage; } public void Navigate( UserControl nextPage, object value ) { this.ObjectValue = value; this.Content = nextPage; } }The overloaded Navigate takes an object and stores it in the PageSwitcher’s member variable ObjectValue. The page you switch to then only has to retrieve it.
The call to this overloaded method is demonstrated by creating an object of type person (which in this simplified version has three member variables, FirstName, LastName and a boolean as to whether the person is a member of the club)
void Switch_Click( object sender, RoutedEventArgs e ) { Person p = new Person(); p.FirstName = FirstName.Text; p.LastName = LastName.Text; p.IsMember = RBYes.IsChecked == true; PageSwitcher ps = this.Parent as PageSwitcher; ps.Navigate( new PageX(), p ); }
p is an instance of person, we pass in to Navigate the new instance of PageX and the new instance of the Person object.
In PageX’s PageLoaded method we look to see if the PageSwitcher’s object is not null, and if not, we cast it to be a person and then we can extract the values…
void Page_Loaded( object sender, RoutedEventArgs e ) { PageSwitcher ps = this.Parent as PageSwitcher; object theObject = ps.ObjectValue; if ( theObject != null ) { Person p = theObject as Person;
Message in this case is a TextBlock that displays the output.
The last bit of of code uses the conditional operator, you read it as “if p.IsMember evaluates true, return the string ‘ is a member ‘ otherwise return the string ‘is not a member yet. ‘
The video goes though this in greater detail, but that is the essence.
I do not pre-announce books.
That said, this book is likely to be of significant interest to this community, and so, now that it is officially listed on Amazon, I thought it reasonable to mention that it is on the way, and that Tim and I are exceedingly proud of it.
Our goal in Programming Silverlight 2 is to tell the story of Silverlight, not to reproduce the documentation. For me, it is a wonderful opportunity to bring together all that I’ve learned in creating the videos and the tutorials and getting your feedback about what is helpful and what is not.
In the book we go far deeper than we’ve had the opportunity to do so far here on the site, but at the risk of undermining sales, let me say that everything we cover in the book we will, no doubt, cover sooner or later here as well. The advantage of the book is that it is all put together in a single place in a single coherent telling.
We’re going to hold the book until Silverlight 2 is certified as final, which means we won’t be first to market, but on the other hand we’ll have it right, and that seems worth while. in addition, the book will mark a beginning, not an end, in that once the book is in print, we will continue to build videos and other material that will add depth for the more advanced programmer, and we’ll continue to create on-ramps for the programmers first arriving at Silverlight from .NET and elsewhere.
Thank you for indulging my book announcements. We now return you to the technical blog, already in progress.
I’m pleased to announce the release of what may be one of the most unusual books I’ve ever written, Programming .NET 3.5
Briefly, it was our theory; generated long before I started work at Microsoft, that while there was good reason to write what I call “silo” books on each of the .NET technologies (e.g., WPF, WCF, etc.) there was a coherence to the entire Microsoft framework that was potentially missed by that approach.
Our other theory was that .NET 3.5 (broadly defined) was the first version of .NET to fully facilitate the development of n-tier applications and MVC (imagine our shock when Microsoft developed the MVC library for ASP.NET!)
All in all it was a blast to write, even though we did have to write it twice (originally we wrote Programming .NET 3, then we totally rewrote it for .NET 3.5, so this is really the 2nd edition!).
I’m not sure more than half a dozen people will buy the book, but it may catch a wave, who knows? In any case, we had fun and learned a great deal while writing it.
I just released Learning ASP.NET 3.5 which is very exciting, through I must
quickly and freely admit that my co-authors did a fantastic job shouldering the bulk of the task of the massive re-write to bring this book fully up to date for ASP.NET 3.5.
The Learning series is O’Reilly’s on-ramp, while the Programming books are targeted at the more experienced and professional programmer. That said, this book is surprisingly comprehensive and we’re quite
proud of it.
There are quite a few good books on ASP.NET 3.5, one written by my colleague Scott Hanselman, that has gotten rave reviews.
Then there’s ASP.NET 3.5 Unleashed by Stephen Walther, new to our team but not new to writing fantastic books on ASP.NeT
Oh yes, I almost forgot, I’m about to release Programming ASP.NET 3.5, due out
Sept. 15.
I suspect there are even some books by people not on our team.
So don’t buy anything until you read through a few books and decide on what you like in terms of style, coverage, approach, exercises and all those intangibles that make for a great technical book.
Enjoy.
I’m pleased to announce that we’ve posted a new tutorial: DataBinding and Data Templates Using Expression Blend available in HTML and pdf with source code.
This should nicely complement the three new videos on DataBinding

I hope you find them useful.
There is a posting going around about how some part(s) of Microsoft are using Flash or some other not-Silverlight technology and how even Microsoft doesn’t believe in Silverlight, blah blah blah. I’ll leave it to people who have investigated and who care to straighten out this silliness, but I will say that from what I can tell, there are a lot of post-hoc ergo prompter hoc errors floating around.
The good news is that this prompted a discussion with a very bright member of our community (ew, what a phrase; take two:) with a buddy that I thought I would post here, cutting down his comments and fixing up mine to make them seem much more incisive.
After some back and forth, this lead us to a discussion of his desire to choose to work in Flash or Silverlight, but really not to try to work in both for any length of time, and did I have any thoughts on the matter.
I wrote…
…for me it was never a question. Microsoft’s commitment to Silverlight is unquestioned and core; and as a developer I focus on (a) the commitment, (b) how does it fit into the lineup of development products and (c) what tools can I use and (d) what is the customer base.
As a .NET programmer for 8 years, Silverlight fits in perfectly, and the commitment to Xaml, first for WPF, then Workflow, then Silverlight, and the backflow from Silverlight to WPF, and the promotion of Scott Guthrie to VP, and the hiring of Ray Ozzie, and the creation of the Expression tools and the people they hired to head those teams, and the creation of the Developer Liaison Group that I work in, and more that I can’t talk about in terms of commitment to Silverlight going forward, all add up to a place I had no doubt I wanted to be and that I still want to be.
….speaking as an individual and not as a Microsoft employee (which I’m told is not possible) I personally would base my decision [as to which to commit to] on what is predictable and not on what is unknowable. So, what can we know with reasonable certainty:
1. Both companies are likely to be around in 5 years, as are both products in some form
2. Both products are likely to evolve, especially in response to one another and for all we know there will be an unexpected third player to come along when we least expect it
3. There will never be an objective view point (who would provide it?) – see my blog post on don’t believe anything I say
While I have a friend who has made a great living by being a jack of all trades, that never appealed to me. Like you, I’d rather stay in one general line of technology; there is enough to learn that I won’t get bored.
So, which? The answer to that (and here I am clearly not talking for anyone but me) is to ask yourself if you have a strong stake in either camp. If you have a strong stake in the Flash/not-Microsoft camp, then I suppose I’m supposed to turn you over to someone who can tell you why you should switch…
If, like me, you have a strong stake in .NET then it is a no-brainer because everything I’ve seen and heard convinces me that Silverlight is the right place to put my chips (no warranty expressed or implied).
Then a final observation, one can complain all one wants about Microsoft, but my experience for the past two decades is that the arc of our products (especially development products) is that they get better over time, usually a lot better and usually quite quickly.
So, I quit 12 years of happy independence and came to work on the Silverlight team. I just passed the 1 year mark, and I’m committed for at least another year. I can’t make a stronger statement than that.