Silverlight

Custom Splash Screen for Windows Phone

The WP7 platform has native support for static splash screens.  In the following post, I’ll show you how just how easy it is: Create an image of size 480 x 800 in your favorite image editor. Save the image as a JPEG. At the moment it looks like the file type must be a JPEG to work.   Include the image in your solution and set the Build Action as Content....

One Day Remaining in the Silverlight Control Builder Contest!

Time is almost up on the 2009 Silverlight Control Builder Contest! So far, we have received 8 entries.  Yes, we have a real contest this year.  If you are planning on entering the contest, make sure you have submitted your entries before 9/19/2009 at 12:00 AM EDT.

Judges Picked for the 2009 Silverlight Control Builder Contest

The deadline for the Silverlight Control Builder Contest is approaching fast, we only have 12 days remaining!  However, if you are planning on entering the contest, you still have time.  We have already received some great entries and I hope we will see more before September 19th. With the deadline approaching, I’ve enlisted help from some of the most prominent Silverlight community champions!  These guys will be helping me judge each of the entries we receive.  A special thanks goes out to Dave Campbell, Pete Brown, and Shawn Wildermuth! Dave Campbell   Pete Brown...

ItemContainerGenerator in Silverlight 3

With all of the new features introduced in Silverlight 3, it’s easy to see how some features get very little coverage (or no coverage at all).  The ItemContainerGenerator is one of those features.  When building controls based upon the ItemsControl, there are many cases when you need to obtain the container for a particular item.  To perform this task in Silverlight 2, you had to develop your own crude implementation of the ItemContainerGenerator.  Fortunately for us, the ItemContainerGenerator is now baked right in! The ItemContainerGenerator for a particular ItemsControl is exposed by the ItemContainerGenerator property: ...

2009 Silverlight Control Builder Contest Announced!

Right on the heels of the Silverlight 3 announcement, the 2009 Silverlight Control Builder Contest was just announced.  The concept is simple, build a control using Silverlight and submit it to the site.  The top 3 entries will win some really cool prizes! Based on feedback gathered from last year, the contest is much improved: The contest is world-wide this time! Extended contest duration.  This year, the contest lasts until September 19th, 2009 at 12 AM EDT. Silverlight 3 entries are accepted (of course!) Contest...

Finding the Target of a Storyboard Timeline

I noticed the other day that Storyboard has a SetTarget method, but it does not have a corresponding GetTarget method.  So how can you find the target of a Timeline child?  Fortunately, Storybard has a GetTargetName method, we can use this method to obtain the name of the target and then search parent container’s children for a matching child.  Suppose we had the following code: <Grid x:Name="LayoutRoot"> <Grid.Resources> ...

A Smaller XAP Preloader for Silverlight

In many situations, it is important that your Silverlight appilcations load as quickly as possible.  For example, when building a Silverlight Advertisement, the user should not experience a significant load time.  The advertisement should load just as fast as the other page assets.  But how do you achieve this when your application includes heavy-weight resources, such as video or images?  Of course you could pull these individual assets from a server during runtime, but if your assets are packaged inside the XAP package, you need a better solution. The most common solution I have seen is to build a...

Star Selector Control Updated

In my spare time, I have been re-writing the Star Selector control that is part of Silverlight Contrib.  I re-wrote this control because there were several things I wanted to accomplish.  This re-write includes quite a few new features.  I will highlight them in the next few sections: Half-Star Selection The control supports enabling half-star selection.  To enable or disable this feature, simply set the AllowHalfStarSelection property accordingly.  The default value is false.   DisplayValue and Value Property Data Types The DisplayValue and Value properties have been changed from an Integer to a double data type.  This allows you to select half-stars and the...

A Cool Trick for Passing Data to a Silverlight Application

As you probably already know, there are quite a few ways to pass data to a Silverlight application. Use InitParams in the Silverlight plugin declaration Read data off the querystring Use WebClient to request a value Interact with the HTML DOM to pull a value from the hosting page But what do you do if you don’t have control over the hosting page?  Really, your only option is to make a call to a web server using WebClient.  But even that...

The Future of Silverlight Contrib

As you may already know, we are merging Silverlight Contrib and Silverlight Extensions into one super-ultra-mega project.  Last month, we held a poll to let the community decide the name of the consolidated project.  Which played out in the following way:     So it’s a no-brainer, obviously the community wants to keep the Silverlight Extensions name moving forward (and we will).  In the next few months, both teams will be working to consolidate the code bases into a single code base.  This will take some time, but moving forward, it will make for...

Bitmap Caching in Silverlight 3

In my opinion, one of the coolest new features in Silverlight 3 is Cached Composition.  Cached Composition is a performance enhancement feature that will allow visual elements to be cached as bitmaps after the first render.  After caching occurs, the application can effectively bypass the render phase for the cached visual elements and simply display the cached elements instead. This is a huge plus for scenarios with scrolling objects!  Before Cached Composition, Silverlight would re-render the object for each frame, even if the object itself never changed.  With Cached Composition enabled, the object is cached and Silverlight can render the object...

Easy Drop Shadows on Text in Silverlight 3

Before Silverlight 3, you had to do perform some less-than-ideal tricks to achieve a drop shadow effect on your text.  In fact, the most decent trick I could find had to rely on the TextBox control and not the TextBlock control since you cannot re-template a TextBlock control.  But even that technique was not optimal since you couldn’t get a truly smooth shadow. Well, that was then an this is now!  In Silverlight 3, you can do the following: <TextBlock Foreground="White" Text="Lorem ipsum dolor sit amet" ...

My Presentation/Code from 2009 Charlotte Code Camp

As promised, I am posting my slide deck and code from my Silverlight Advertising presentation at the 2009 Charlotte Code Camp.  The turnout was great and I had some good questions!  The Charlotte guys hold an excellent code camp.  I always enjoy making the trip! Download Presentation

Silverlight Contrib to Merge with Silverlight Extensions

The Silverlight Contrib and Silverlight Extensions projects will be merging into a single project soon.  By consolidating the two projects we hope to provide an even more valuable resource to the Silverlight Community.  Before the consolidation, both projects were hosted on CodePlex and shared the same Ms-PL licensing.  This will not change, however, there will be only one unified project moving forward. Obviously, both teams are fond of the names chosen for their open source projects, so we decided it would be best if we let the Silverlight community decide which name to go with moving forward.  Whichever project name receives...

Silverlight Contrib 2009.1.0 Released!

Silverlight Contrib 2009.1.0 has just been released.  This release includes the CoolMenu refactoring that was featured as a three part series on this blog.  I still have quite a few improvements to make on this control, but I figured it would be good to get out the enhancements that have been made so far. SilverlightContrib.org CodePlex/SilverlightContrib For your convenience, I’ve copied the release notes for 2009.1.0 below:   A special thanks goes out to Robby Ingebretson for contributing some really cool Visual Studio Snippets and Tim...

Custom Loading Screens in Silverlight

About 99% of the time, when I watch a Silverlight application load, I see the standard loading animation.  I’ve seen some really cool Silverlight applications with a highly polished user experience and yet, they don’t spend an extra 10 minutes to make the loading experience decent.  This is very surprising to me because it is so very easy to make your own custom splash screen that blends much better than the standard splash. Default Loading Experience in Silverlight (Meh…) It’s not that I don’t like the default loading animation.  I just get tired of seeing it in almost every single Silverlight application...

Refactoring the CoolMenu Control – Part 3: CoolMenu Behaviors

Part 1: Inheriting from ItemsControl Part 2: Building the ItemContainerGenerator Introduction One of the suggestions I have received from feedback on this control was to allow users of the CoolMenu to add custom effects.  There are 2 different places where I could see a user wanting to change the default behavior on this control. The first place would be how the control behaves as the user moves the mouse over each item.  The other place would be the behavior exhibited by the control when a user clicks on a particular item. ...

Refactoring the CoolMenu Control – Part 2: Building the ItemContainerGenerator

Part 1: Inheriting from ItemsControl An ItemContainerGenerator is a class that generates the containers for each of the items in an ItemsControl.  At least, that is how things are in WPF.  In Silverlight, this class doesn’t exist.  That’s too bad because there are some methods that we really need.  Most importantly, we need to be able to capture a container for any given item index via the ContainerFromIndex and IndexFromContainer methods. I did some research and found that the Silverlight Toolkit team has already encountered the same issue in their TreeView control.  The Silverlight Toolkit team solved the...

Refactoring the CoolMenu Control – Part 1: Inheriting from ItemsControl

Introduction After receiving some very constructive feedback from Justin Angel on my CoolMenu (View Demo Here) control, I decided to refactor the control to allow for a more flexible developer experience.  I wanted to document my experience with this so that others might benefit.  This series will walk through the various refactorings that I have been working on to make this control better. Inheriting from ItemsControl One of the biggest issues with the control was the fact that it did not inherit from an...

Silverlight Contrib 2008.0.0 - Alpha 3 Available!

  Silverlight Contrib Alpha 3 has been released!  This release builds upon the Alpha 2 release with minor enhancements in many areas.  As always, we are requesting your feedback so we can make the product better!  Also, if you think you could help make Silverlight Contrib better and are serious about helping, we would love to hear from you!  We need all the help we can get!  Thanks! Silverlight Contrib 2008.0.0 - Alpha 3 Download Changes since the last release: Added API Documentation...

Building a Resizable Silverlight Control

When building a Silverlight control, in some situations, you need the visual elements of the control to scale according to the size of the control.  Sometimes, this is easy because you can simply leave the height and width dimensions unspecified for the visual elements and they will fill to consume the available space in the parent container.  But in more complex situations, you need to be able to specify the dimensions of the visual elements in your control.  The color picker control illustrated above has different parts, each of which should maintain the appropriate relative...

Using ReSharper with Silverlight

ReSharper is a great tool for developer productivity.  I absolutely can't live without it!  If you haven't already tried ReSharper, you should do yourself a favor and go download it now.  It takes a while to get used to, but once you grok the features (namely the keyboard shortcuts), you will see how powerful this tool really is. Ok enough with the testimonials, how can you take advantage of ReSharper when working on Silverlight projects?  If you have ever used Resharper, you may know that it has a great feature called Templates.  Templates give you the ability to quickly...

Tweaking OnApplyTemplate Event Timing in Silverlight 2

When building a custom control in Silverlight 2, the OnApplyTemplate method gives you the opportunity to “wire-up” logical instances of elements in your control.  When a control is loaded, it is important to realize that in Silverlight 2, this method is not triggered very early with respect to other events.  In other words, you could very easily write code that fails just because of where you call it.  Understanding the control’s life cycle will help in avoiding these situations. At the time this was written, the MSDN documentation stated: “The timing of the Loaded event in Silverlight differs from the timing of...

Finding a Storyboard in the VisualStateManager

A few weeks ago in the Silverlight forums, a user asked how they could attach to the OnCompleted event of a Visual StateManager animation.  At first, this sounds trivial, but the VisualStateManager does not directly expose a way to obtain a Storyboard.  However, the VisualStateManager does return a list of the VisualStateGroups through the GetVisualStateGroups method.  We can take advantage of this method to obtain a reference to the desired storyboard. The FindStoryboard method defined in this helper class iterates over each of the VisualStateGroups until it finds a match, it then iterates over each Visual State in the group until...

Silverlight Toolkit Released on CodePlex!

As previously announced by Shawn Burke on his blog, the Silverlight Toolkit has just been released!  Much like the AJAX Control Toolkit for ASP.NET, the Silverlight Control Toolkit Team will be introducing new controls and features which may eventually make it into the Silverlight platform.  I like to think of it as an incubator for new controls in Silverlight.  This is really cool because it gives the community the chance to use the controls much earlier and provide valuable feedback to help influence the product direction.  Another added benefit to this is that the...

Silverlight Contrib 2008.0.0 – Alpha 2 Released!

It’s been a while, but Silverlight Contrib 2008.0.0 – Alpha 2 has finally been released!  I have to admit that I changed the original goals for this release, but that’s the type of thing that happens when you get tons of unexpected support from the community.  I’d like to personally thank Koen Zwikstra, Rob Houweling, and Shawn Wildermuth for helping with this release. Be sure to check out the new site at SilverlightContrib.org.  While most of the project will be hosted on CodePlex, this site will serve as the main...

Silverlight 2 will be released on October 14th, 2008

In a press conference today, Scott Guthrie announced the availability of Silverlight 2 on October 14th, 2008!  Congratulations to the Silverlight team on this exciting release, this is going to be a great product!

Sharing Code Between .NET and Silverlight Platforms

Quite often, I hear people asking if they can use .NET assemblies compiled for the full .NET runtime in Silverlight.  Unfortunately, this just isn’t possible, the Silverlight runtime is a subset of the full .NET runtime and for code to run correctly under the Silverlight runtime, there are various dependencies that must be linked and verified at compile time.  But (there is always a but), there is one technique that you can use that effectively allows you to write your code once and have it work in both Silverlight and regular .NET applications.  This isn’t a new technique, but I’m...

Richmond, VA Code Camp 2008.2 this Saturday

Richmond, VA Code Camp 2008.2 will be held this Saturday (October 4th, 2008).  For those of you that haven’t registered yet, what are you waiting for?  Kevin Hazzard has done a great job organizing the event and there is an excellent speaker roster. Be sure to look for me at the event, I’ve got the only Silverlight presentation slot ;) Register Here Speaker List

Silverlight 2 RC0 is Available!

Silverlight 2 RC0 has just been released and, as usual, Scott Guthrie has punctuated the release with another informative blog post. Summarizing Scott's post, here are a few of the things to expect from RC0: Bug Fixes ComboBox PasswordBox ProgressBar MessageBox.Show() New Control Skins (Much Nicer!) General Improvements various Subsystems Of course, you can also download a more comprehensive list of breaking changes. It's also worth noting that this release is staggered in such a way that only the...

Microsoft Introduces the Silverlight/WPF Controls Team

Today, Shawn Burke announced on his blog that Microsoft had recently organized a new controls team that will focus their efforts on developing controls for use in Silverlight and WPF.  The team has an impressive roster and there is no doubt that we will see some great things from this group!  After the release of Silverlight 2 - Beta 2, I was wondering how Microsoft would be able to continue to ship the source code for the controls since most of them have been integrated into the core product.  But with this announcement, it is evident that this organization will...

Silverlight Contrib: Targets for Next Release

So it has been a few weeks since I introduced Silverlight Contrib.  So I thought I would post a quick update about the status so far.  I've received a lot of positive feedback and volunteer offers (more on that below), which has been great!  I've been working hard on the next release, here is what is planned for the next release: Improvements on mouse-capturing on the Color Picker Control. Color Picker Control - Adding the ability to supply a value for the selected color and have then control respond accordingly....

Introducing Silverlight Contrib

I've just started a new project on CodePlex called Silverlight Contrib.  The aim of this project is to offer the most comprehensive collection of free and open source Silverlight controls.  The first drop is very small, but with support from the community, I hope to grow this collection into a full suite of controls that you can incorporate into your solutions. Interesting in Contributing? I really need your help for this project to succeed.  I am currently seeking people that are interesting in working on the project with me. ...

CoolMenu: A Silverlight Menu Control

I thought it would be cool to try building a reusable container control so I came up with CoolMenu.  You really have to try this one out to get the full experience, a screen shot just doesn't do it justice.  CoolMenu is a Silverlight container control that gives you a nice wave-like effect as you move your mouse over the menu items.  Clicking a menu item causes the item to bounce. You could probably use this control in many scenarios.  Other than the obvious menu navigation scenario, some potential possibilities include: Card Game - Show your current hand ...

Adding Custom Collections to your Silverlight Controls

When building custom controls, you often need to allow the user to add a collection of items to the control either programmatically or through XAML declaration.  For example, suppose you are building a menu control and you need to allow the users of your control to add controls as children to your control.  The ListBox is one such example: <ListBox Width="100" Height="300">     <ListBoxItem Content="Testing1"></ListBoxItem>     <ListBoxItem Content="Testing2"></ListBoxItem>     <ListBoxItem Content="Testing3"></ListBoxItem> </ListBox> ...

Silverlight: Write and Win

  The SilverlightShow has just started a new contest for writing silverlight articles.  This is a great opportunity to contribute to the community and have the chance to win some nice prizes at the same time.  The contest starts today (Monday, August 18th, 2008) and concludes on Sunday, September 28th at 23:59 GMT.  Check out the contest site for more information including rules and prizes!  Good luck!

A Really Nice Carousel Control

Last Thursday (August 7, 2008), I presented at the Greater Charleston .NET User Group.  Before the meeting, I had the chance to see a demonstration of really cool carousel control written by Matthew Drake.  I told him that I wanted to share it with the community and he gave me permission to post a demo on my site.  He was actually planning to submit the control to the Silverlight Control Builder Contest.  Unfortunately, there was some confusion about the deadline and he wasn't able to submit the control.  I really think the demonstration of his control is cool because it...

Congratulations to the Winner!

I'd like to personally congratulate, Faisal, the winner of the Silverlight Control Builder Contest!  Faisal submitted a really cool Fish Eye Grid control.  A special thanks goes out to Faisal for taking the time to develop and submit a control for the Silverlight Community! FishEyeGrid Silverlight control for representing items in a grid that renders them with a fisheye lens effect. When the mouse is moved over the grid, the items transform (scale & translate) to a fisheye lens effect. Items under the cursor become larger while those farther away become...

Not What I Expected

So the Silverlight Control Builder Contest is now over and after all that excitement and anticipation from the community we got, a single, solitary entry.  One person took the time to build a Silverlight control and submit it to our contest.  I have to admit that we were expecting a little more of a response than that.  We actually received more unique vendor contributions than we did contestants.  To compound the disappointment, the contest site accumulated over 2,300 unique visitors with a total of about 9,500 page views throughout the duration of the contest, so it wasn't like nobody knew...

A Customizable Silverlight Star Selector Control

I thought I would post the source code for a control that I typically demonstrate at my Silverlight presentations.  I usually show this control at the end of my presentation, so I never really get to talk about the control as much as I like.  As you can probably infer from the image below, this control presents 4 stars/hearts/whatever and, by hovering your mouse over the control, you can change the state of the control.  Clicking on a particular star will set the rating for the selector. I think this screenshot really illustrates the awesome skinning capabilities of Silverlight.  Keep...

7 Days Remaining in the Silverlight Control Builder Contest

  This is just a quick reminder to let you know that we are now down to one full week in the Silverlight Control Builder Contest.  If you are considering entering the contest, but haven't yet, we have not yet received any (valid) entries so your chances of winning a prize are very high!  All entries are due before August 11th, 2008! ...

Controlling your Treadmill from Silverlight - Part 3

Controlling your Treadmill from Silverlight - Part 1 Controlling your Treadmill from Silverlight - Part 2 In the final post for this series, we will be expanding the usefulness of our application by adding a workout feature.  This feature will allow you to craft workouts (in XML format of course) and then have the application execute them.  The application will render a nice visualization so you can monitor your progress as you burn off those calories. Separation of Concerns As with any application, complexity...

Speaking at the Richmond, VA Code Camp on October 4th, 2008

I just found out that I'll be speaking at the Richmond, VA Code Camp on October 4th, 2008 (Thanks to Lou Vega and Kevin Hazzard!).  I'll probably be delivering my Silverlight Controls presentation once again.  This should be a fun trip since I grew up in Virginia and I haven't been back in several years.  Maybe I can make a stop in my hometown, South Boston.  It looks like quite a few of us will be making the trek from South Carolina to speak, including Lou Vega, Chris Craft, Chris Eargle.  See you there!

Controlling your Treadmill from Silverlight - Part 2

Controlling your Treadmill from Silverlight - Part 1 In the first part of this series, I demonstrated a Silverlight application that controls a treadmill.  Today, we will go into a little more detail on using various audio signals (aka Chirps) which, in turn, instruct the treadmill to change settings.  To keep things simple, we are going to just focus on the speed and incline aspect of the application in this post.  In the next post, we will enhance the application by adding a feature that will allow you to create treadmill workouts. Obtaining the Chirps In order to...

Controlling your Treadmill from Silverlight - Part 1

Introduction If you are like me, you have a treadmill that sits in your garage collecting dust while you sit in front of your computer all day.  Well, it's time to drag that 350-pound waste of metal within reach of your computer so you can wire-up some bleeding-edge technology to it!  Yes, we are going to control your treadmill with Silverlight.  Off to the side, you will see a picture of my treadmill (at least it looked that way when I bought it).  This is the IMAGE 15.0Q Treadmill.  It's your average treadmill with speed and incline...

Only 21 Days Left to Submit your Controls!

The clock is ticking down and you only have 21 days left to submit your controls to the Silverlight Control Builder Contest!  Even if you have already seen the prizes, you should go check them out again.  We have added a ton of new prizes since the contest began at the beginning of July.  In addition to giving away a control suite from almost every major Component Vendor, we are giving away gift-certificates to Amazon and NewEgg. 

Protecting Secrets in your Silverlight Applications

This should go without saying, but I've heard the question asked enough to warrant a blog post.  Generally speaking, the developer would like to store some secret information in a Silverlight application and, at the same time, prevent someone from accessing that information.  A secret, in this context, is anything that could be used to compromise the system or any information that should not be disclosed to unauthorized entities. Let's take a quick look at how Silverlight applications are packaged and deployed.  When you build a Silverlight application, your code is compiled into one or more assemblies. ...

Save File Dialog in Silverlight

This is not an original idea, but someone had asked this question on the Silverlight Forums and I couldn't find an answer written with ASP.NET so I thought it would be nice to provide a complete example here on my site. Suppose you are generating a file in your Silverlight application and you would like to allow the user to save the file on their computer in the location of their choosing. Currently, there is no mechanism that allows for this in Silverlight.  However, since Silverlight is hosted inside of a web browser, you can...

Source Code from CDEG Presentation

Some of you have asked for the source code from my presentation at the Columbia Developers Enterprise Guild so I have posted the code for download.  Enjoy! Download: Source Code from Presentation

Silverlight Control Builder Contest: More Prizes Added!

Since the initial announcement of the Silverlight Control Builder Contest, we've received a lot of attention and support from various vendors!  I am happy to announce that we have added prizes from vendors like Telerik, Xceed, and the SilverlightShow to the contest prize purse.  If you look on the prizes page, you can see that we are really giving away a lot of stuff!  A special Thanks goes out to all the vendors for helping to make the contest...

Speaking at Columbia Developers Enterprise Guild

I will be speaking about building Templatable Silverlight Controls at the Columbia Developers Enterprise Guild on Wednesday, July 9th, 2008. Presentation Details Creating reusable controls is an important aspect of productive software development. When you can supplement this reusability with customizability, you have the power to rapidly deliver seamless and compelling user experiences in your products. Silverlight offers both of these through the use of custom templatable controls. In this presentation, we will take a short journey through the process of building a custom control using Silverlight. See you there!

VSM Strangeness

The Problem While migrating a Silverlight 2 Beta 1 control to Beta 2, I encountered some odd behavior with the VisualStateManager and I thought I would document my experience in the event that you might run into the same issue.  From what I can tell, this only occurs when you have multiple instances of a control that change state by animating color properties (ColorAnimation).  There may be other ways to induce this behavior, but the following is the only way I have encountered personally.  Simply put, calling VisualStateManager.GoToState to does not always go to the correct state...

2008 Silverlight Control Builder Contest

It's been a little quiet here on my blog for the past few weeks, but tonight you will know why!  I am excited to announce the Silverlight Control Builder Contest!  Ripping the content straight off the front page (I can do that, I wrote it!): ...

Predicting the Future of Silverlight (with help from Scott Guthrie)

With the achievement of many product milestones at Microsoft, you can generally expect a post from Scott Guthrie.  These well-written posts usually contain valuable information about the future product direction so it's always a good idea to read these posts (along with the comments) if you want to pick up on these tidbits.  Below, I have extrapolated a few interesting items about the future of Silverlight from the Silverlight 2 - Beta 2 Post: "We ultimately expect to ship over a 100 controls for Silverlight" This is cool, because...

Silverlight Samples Updated to Beta 2

I have updated a few of my Silverlight demo applications to work with the Beta 2 release of Silverlight.  The update was fairly painless, but then again, these are really simple applications :)  Color Picker Control (Source Code) Simple Color Picker control built with Silverlight.  Useful in applications that require advanced color selection options. Silverlight Binary Clock (Source Code) Just a simple Binary Clock with a live reflection.  Since we don't have a visual brush in Silverlight, I...

Silverlight 2 Beta 2 Download is Available Now!

As promised by BillG himself earlier this week, Silverlight 2 (Beta 2) has just been released.  I've compiled a few resources to get you started.  Enjoy! Microsoft Silverlight Tools Beta 2 for Visual Studio 2008 Silverlight 2 Runtime Download Silverlight 2 Beta 2 SDK Silverlight 2 Beta 2 SDK Documentation (CHM) Expression Blend June Preview - Containing the Visual State Manager Web Developer Tools Team Blog Post (What's new in Beta 2) Enjoy!

Silverlight 2 Beta 2 - The Full List of Changes

Over at the Silverlight SDK Blog, a new post containing the full list of changes has been made.  Some of the things that I thought would certainly make this release (like a combo box) do not appear.  Although, I did read somewhere that there would be approximately 3-dozen controls after this release, so maybe we will be surprised! Check out the full list here

Silverlight 2 - Beta 2 arrives this week!

Today at Tech-Ed, Bill Gates announced Silverlight 2 - Beta 2.  The new beta is slated for release sometime this week. Here are a few authoritative news items that I found relating to the new beta: Silverlight 2 Beta 2 Releasing Soon! [Silverlight SDK Blog] Placeholder for new Silverlight Controls Documentation [MSDN Library] Beta 2 Event Bubbling [Jesse Liberty] Creating Control Skins with Visual State Manager - An Introduction [Christian Schormann] Interview with Jesse Liberty about Silverlight 2 - Beta 2...

Silverlight on Large Displays

At the ACS National Convention in Houston, Texas this past week, we demonstrated a proof-of-concept using Silverlight and large displays like the 46" Samsung HD LCD Panel pictured below.  Similar to the displays you see in hotel/company lobbies, this simple concept shows off just one of the many scenarios in which Silverlight can be used.  By taking advantage of the VideoBrush in Silverlight, we were able to give the display a subtle, yet attractive, animated back-drop for our announcement text.  We also took advantage of Silverlight's full-screen mode to completely hide the browser window.  There are a few noticeable hiccups...

New Silverlight 2 Beta on the Horizon?

With the VS2008 and .NET Framework 3.5 Service Pack 1 Beta released Scott Guthrie has posted a very detailed article on the new features and changes that this service pack introduces.  Unfortunately, this beta release is incompatible with the current Silverlight tools beta.  However, ScottGu hints that a new version of the Silverlight tools will become available in the next few weeks.

Speaking at Charlotte Code Camp on May 17th

I'll be delivering a Silverlight presentation at the Charlotte Code Camp on Saturday, May 17th, 2008.  If you live within a reasonable distance from Charlotte, go and register now!  This is a free event and a great opportunity for you to talk with your peers and to learn some new things. Click here to view the tentative schedule

Silverlight Exception Logging

A question was recently asked in the forums about logging client-side Silverlight exceptions on the server-side?  Of course, my first guess would be to create code that would trap exceptions and call out to a web service for logging purposes.  But why do that when someone has already done all the work for you?  Daniel Vaughan has developed Clog (Client Logging) a customizable logging system for Silverlight.  You can read all of the details about Clog in his article on CodeProject.  Enjoy!

Synchronous Web Service Calls in Silverlight

There seem to be a lot of strong opinions about the absence of Synchronous Web Service calls in the Beta 1 release of Silverlight 2, so I thought I would try and condense the points brought forward by the two opposing forces into an easily digestible format. Camp 1: Synchronous Web Service calls are missing and rightly so! Synchronous calls will block the web browser's UI thread, rendering the browser unresponsive. Microsoft did this to prevent developers from....<<insert self-mutilation saying here>>. Microsoft did this to protect Silverlight platform from...

Subscribing to Silverlight Managed Code events from JavaScript

In Silverlight, it seems that most of the time, you need to reach into the hosting page from the managed world, but what if you want to reach into the managed world from the hosting page?  In other words, what if you want to subscribe to a managed event from JavaScript? Let's look at an example.  Suppose we have a button in our Silverlight application for which we want our web page to respond. XAML: 1: <Button x:Name="Button1" Height="35" Width="120" Content="Do Something" Click="Button1_Click" /> ...

Calling arbitrary JavaScript from Silverlight

The question of calling JavaScript functions from Silverlight seems to come up quite often and there are solutions to the problem.  But one answer I have not seen yet is to use the HtmlPage.Window.Eval method.  This method is simply a pass-through to the Eval method in JavaScript on the browser end.  It might not be an appropriate solution in all cases, but it's always nice to have options! 1: // C# Code 2: HtmlPage.Window.Eval(string.Format("doSomething('{0}');", "hello there!")); 1: // JavaScript Code ...

Downloading and Extracting Silverlight Resources at Runtime

One nice feature of Silverlight is the ability to load resources from the server at runtime.  For example, suppose your application needs to display text in a specific font.  Ideally, your code would call out to the server (using WebClient) to pull these resources only as they become necessary.  The cool thing is that you can zip up any resource you have and then extract it for use on the client side. 1: WebClient webClient = new WebClient(); 2: webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted); ...

Silverlight PasswordBox missing from Beta 1

If you have done any work with the controls in the Silverlight beta, you may have noticed the absence PasswordBox.  I posted a question in the forums asking for this functionality and the current word from Microsoft right now is that it might be included in the final release, but no promises.  Until that day, there are alternatives.  You can write your own, or you can use the one written by Chris Pietschmann.  Enjoy!

Building a Silverlight Color Picker Control - Part 3

Now that we have the XAML UI complete on our color picker (live demo here), it's time to wire up the control with some logic.  To spare you the boring details, this post is really just a summary of the key pieces of logic.  Obviously you can download the complete source code, and if you have any questions, please feel free to send me feedback! As a first step, we need to make the selectors responsive to the various mouse actions.  The hue selector on the left side of the control responds to mouse dragging and clicks in the Y direction. ...

Where are the Layout Templates for Built-In Silverlight Controls?

When customizing Silverlight controls, there are several techniques you can follow.  Each technique provides a varying level of control and development effort.  If you want to change the layout of any of the built-in Silverlight controls, you will generally need to work from the existing default template contracts as a starting point.  So where are these template contracts?  Currently, there are two places you can find these templates: SDK Documentation The SDK documentation contains a subsection called Control Styles and Templates.  In this section, you will find the default XAML template contracts for...

Silverlight 2 has a Timer (DispatcherTimer)

Before Silverlight 2, one had to conjure up various hacks to emulate a Timer.  One the most popular hacks was to use a StoryBoard that would continually call upon itself after completion.  This would end up looking something like the following: 1: public partial class Timer : UserControl 2: { 3:   4: public delegate void TimerFiredHandler(); 5: public...

Silverlight 2 Controls - First Impressions

With the release of Silverlight 2, a new set of standard controls have been introduced.  Kathy Kam has built a nice sample that shows off these controls.  Below are a few key points that I took away from watching Scott Guthrie's Silverlight Keynote: Controls are open source Unit tests for controls included Unit test framework for testing UI and non-UI functionality included More controls from Microsoft on the way DataGrid and DatePicker controls included Control layouts can be changed using Templates...

Silverlight 2.0 Beta 1 is Here!

Silverlight 2.0 Beta 1 has just been released just before the start of Mix08.  Enjoy! http://silverlight.net/forums/t/10586.aspx http://msdn2.microsoft.com/en-us/library/bb404700.aspx

Building a Silverlight Color Picker Control - Part 2

This is a multi-part series on building a Silverlight Color Picker Control, please check out the Introduction if you missed it! Before we write any actual code, it's nice to have some visuals to use as a reference.  There are many ways to represent color spaces.  One of the most common color space representations allows the user to pick a hue and then pick a saturation/luminosity combination.  The diagram below is a simplified view of this layout.  From this diagram, we can infer the XAML primitives that will be necessary to present our control. Hue Selector The...

Building a Silverlight Color Picker Control

It doesn't appear that there will be a color picker control in the upcoming release of Silverlight.  Of course, this is just a beta, so things may change.  Either way, I've developed a simple color picker for use in your Silverlight applications.  My ultimate goal is to make HTML hex color code color selection easier in ASP.NET applications.  Sure, there are various color pickers available for just about every platform, but you really would appreciate how little code it took to get this working.  This is really a testament to the excellent architecture of the WPF platform.  Each of the...