Microsoft Silverlight 2 released

After many months of beta testing Microsoft Silverlight 2 it has been officially announced that it will release today, the 14th of October 2008.

A release build was expected to emerge sometime in November so it seems the team is very confident with the RC0 developer-only build that emerged recently. Unluckily for my team we just released our new product on Friday based on Silverlight 2 beta 2 under the Go-Live license thinking we had at least a month before Silverlight 2 released to fix up compatibility issues. Looks like this week is going to be a busy one for us.

Here is a snippet from the official press release:

Silverlight 2 will be available for download on Tuesday, Oct. 14, at http://www.microsoft.com/silverlight. Customers already using a previous version of Silverlight will be automatically upgraded to Silverlight 2.

What is awesome though is that Microsoft will soon release an extra set of Open Source controls known as the Silverlight Control Pack including a DockPanel, ViewBox, TreeView, Accordion and AutoComplete control.

Managed type converters and Blend resolved

I previously posted about Blend 2.5 June Preview not supporting managed type converters and I’m pleased to report that the team has resolved it according to the bug report that I filed.

Hopefully we’ll see a new build of Blend 2.5 very soon as I’m quite tired of not being able to size DataGrid columns properly. In the meantime I’ve resorted to using the MinWidth property, but it isn’t quite the same.

Blend doesn’t support managed type converters

If you are busy trying to develop using Microsoft Silverlight 2 beta 2 and Microsoft Expression Blend 2.5 June Preview you might have encountered errors while working in Blend such as The TypeConverter for "DataGridLength" does not support converting from a string. although Visual Studio doesn’t complain about the XAML and the code runs just fine.

Well its a confirmed issue in Expression Blend according to the feedback I’ve received on my bug report. The official word from Microsoft is as follows:

Thank you for your feedback. For the June Preview Blend does not support type converters from managed code (all the type converters defined in non-runtime assemblies). This is something that we are working on supporting for RTM but unfortunately do not have it working yet.

What this means is that any custom control development, including Microsoft’s own controls can potentially suffer from this issue as TypeConverter implementations that are not part of the Silverlight 2 beta 2 runtime are not supported. If you have encountered this issue in Expression Blend then please rate and validate the bug so it will be fixed.

WatermarkedTextBox control for Silverlight 2 beta 2

Microsoft SilverlightWhen Microsoft released Silverlight 2 beta 1 they included a really cool control called the System.Windows.Controls.WatermarkedTextBox control. It lived in the assembly System.Windows.Controls.Extended.dll and was included in your XAP file when you did a build. However in Silverlight 2 beta 2 the one control that didn’t make it was the WatermarkedTextBox control.

So by popular request, I have upgraded the original source code which Microsoft published under the Microsoft Public License, I have repackaged the control to ease the migration of existing beta 1 applications. In order to avoid any confusion I’ve changed the namespace of the control. This should hopefully prevent any issues when or if Microsoft decide to release their own version again.

To use the replacement control, simply build the provided solution and add a reference from your existing project to the assembly CraigN.Windows.Controls.dll and use the namespace CraigN.Windows.Controls. So typically this will involve adding xmlns:CraigN_Windows_Controls="CraigN.Windows.Controls;assembly=CraigN.Windows.Controls" to the UserControl element of your XAML file.

Then simply prefix all WatermarkedTextBox elements in the XAML file with CraigN_Windows_Controls: and all code should build again.

You can download the source code from here. I have taken the time to ensure that original test cases build. If you have any comments or suggestions, I’d like to hear them.

Silverlight 2 Beta 2 now available

Microsoft Silverlight Microsoft earlier this week announced at Tech-Ed North America 2008 that Microsoft Silverlight 2 beta 2 will be available for download this week.

The new Silverlight 2 beta 2 control updates the version number from 2.0.30226.2 to 2.0.30523.6. This release is expected to break compatibility with Silverlight 2 beta 1 while improving compatibility with Silverlight 1. For a full list of changes and new features, take a look here.

Please note, that you should uninstall all previous Silverlight 2 beta 1 bits before you attempt to install the new beta bits. The Silverlight 2 beta 2 control seems to upgrade seamlessly enough though. A list of stuff that should be removed includes:

  • Microsoft Expression Blend 2.5 March Preview
  • Microsoft Silverlight Tools Beta 1 for Visual Studio 2008
  • Microsoft Silverlight 2.0 SDK Beta1

Also note that the Microsoft Silverlight Tools Beta 2 for Visual Studio 2008 will install fine on top of Visual Studio 2008 RTM or Visual Studio 2008 Service Pack 1 Beta.

Well they were really cutting the before the end of the week promise close but you can now get hold of the latest beta developer bits using the following links:

If you aren’t using Visual Studio 2008 then you can download the SDK on its own using the following link:

I’ve also noticed another build of the Silverlight 2 beta 2 control that is targeted for developers. I assume it has more debugging support as its slightly larger in size. I don’t think its included in the Microsoft Silverlight Tools Beta 2 for Visual Studio 2008 installer.

And if you liked the Deep Zoom technology that was first shown in Silverlight 2 beta 1 then get yourself an updated set of tools to work with Silverlight 2 beta 2:

I personally can’t wait to get started with this new build as it now finally carries a commercial Go Live license.

Take a look at the following post which goes into details about the new features in the Silverlight Tools for Visual Studio 2008.

  1. WCF templates for Silverlight Enabled.
  2. Build configurations.
  3. XAML Validation now reports build errors.
  4. Setup Improvements.
  5. Projects created in Beta 1 are prompted for conversion when opening to Beta 2
  6. Linking a Web Site to a Silverlight Application.

[tags]Silverlight,Silverlight 2,Tech-Ed[/tags]

What’s New in Silverlight 2 beta 2

Microsoft SilverlightThe Silverlight SDK blog has an overview of what new features to expect from the Silverlight 2 beta 2 release coming this week.

Highlights for me include:

  • DataGrid improvements: Autosize, Reorder, Sort, Performance increase, and more
  • Improved Templating Model: Visual State Manager
  • Including controls in the runtime instead of having them packaged in app package
  • Limited keyboard support in FullScreen mode (arrow, tab, enter, home, end, pageup/pagedown, space) – This opens up Silverlight 2 for gaming.
  • Cross Domain support in Sockets
  • Cross Domain security enhancements
  • BrowserHttpWebRequest and WebClient callable from BackGround Threads
  • Duplex communications (“push” from Server to Silverlight client)
  • Significantly improved SOAP interop
  • ADO.NET Data Services support
  • Changes in application model for multilingual apps (one xap per supported locale)
  • CurrentCulture and CurrentUICulture Isolation

This looks like its going to be an awesome new beta.

[tags]Silverlight,Silverlight 2,news[/tags]

Silverlight 2 beta 2 releasing this week

Microsoft SilverlightSome cool news coming out of Tech-Ed North America 2008 today from Bill Gates himself. Firstly Silverlight 2 beta 2 will be available this week including a commercial Go Live license and updated developer tools such as Microsoft Expression Blend 2.5 June 2008 Preview and Microsoft Silverlight Tools for Visual Studio 2008 beta 2.

This is great news for all Silverlight developers out there. From what I’ve read online this new release is going to break some compatibility with beta 1 but increase compatibility with Silverlight 1 and add a whole bunch of new and improved features as well as improved controls.

In addition we’ll see Internet Explorer 8 beta 2 out in August.

[tags]Silverlight,Silverlight 2,news,Tech-Ed 2008[/tags]

Silverlight 2 with Brad Abrams

Brad Abrams Yes you heard it here first! Brad Abrams, the man, the legend, is coming to South Africa and is taking time out of his busy schedule for SA Developer .NET events in Johannesburg and Cape Town.

Before you ask how I can speak so highly of the man, take a look at his bio and you’ll realise that he isn’t some newbie developer at Microsoft Corp, he is one of the geeks that make us geeks happy with new technology:

Brad Abrams was a founding member of both the Common Language Runtime, and .NET Framework teams at Microsoft Corporation where he is currently the Group Program Manager for the UI Framework and Services team which is responsible for delivering the developer platform that spans both clients and web based applications as well as the common services that are available to all applications. Specific technologies owned by this team include ASP.NET, parts of Silverlight, and Windows Forms.

Brad has been designing parts of the .NET Framework since 1998 when he started his framework design career building the BCL (Base Class Library). Brad was also the lead editor on the Common Language Specification (CLS), the .NET Framework Design Guidelines and the libraries in the ECMA\ISO CLI Standard.

Brad co-authored Programming in the .NET Environment, and was editor on .NET Framework Standard Library Annotated Reference Vol1 and Vol2 and the Framework Design Guidelines.

Brad graduated from North Carolina State University in 1997 with a BS in Computer Science. Find recent musings from Brad on his blog at: http://blogs.msdn.com/BradA/

So take a moment and register for an event:

So what are you waiting for? Remember, the events are FREE to attend so tell your friends about it, register and we’ll see you there.

[tags]SA Developer .NET,Brad Abrams,event,Silverlight,Silverlight 2[/tags]

How to switch Silverlight UserControls

One of the guys on the official Silverlight community forums posted an interesting question, namely how does one change the currently visible UserControl in a Silverlight 2.0 application. To put things in context the new Silverlight 2.0 project template creates two classes for you: a System.Windows.Application derived class named App with the associated App.xaml and App.xaml.cs files; as well as a System.Windows.Controls.UserControl derived class called Page with the associated Page.xaml and Page.xaml.cs files.

The App class takes care of the initialization and basically you assign a new instance of your Page class to the App.RootVisual property and through the power of Silverlight it appears on your screen. 🙂

So if you wanted to change the currently displayed UserControl for another instance naturally you’d try and set the App.RootVisual property to another instance of a UserControl. This sounds great in theory but it seems that its a single assignment property. Pete Brown’s blog post happens to make mention of this.

So in a quest to solve the problem I’ve implemented a very simple UserControlContainer class that allows the developer to switch controls at runtime without having to deal with the set once RootVisual property.

Simply create a new UserControl called UserControlContainer and copy the following into the UserControlContainer.xaml.cs file:

    public void SwitchControl(UserControl newControl)
    {
        LayoutRoot.Children.Clear();
        if (newControl != null)
        {
            Height = newControl.Height;
            Width = newControl.Width;
            LayoutRoot.Children.Add(newControl);
        }
    }

Next set your Application instance RootVisual to an instance of the new UserControlContainer in the Application_Startup method.

    private void Application_Startup(object sender, StartupEventArgs e)
    {
        // Load the main control
        this.RootVisual = new UserControlContainer();
        Page page = new Page();
        ((UserControlContainer)this.RootVisual).SwitchControl(page);
    }

Then wherever you need to switch out the active control, simply call the following if you are inside App.xaml.cs:

    TestControl1 testControl = new TestControl1();
    ((UserControlContainer)this.RootVisual).SwitchControl(testControl);

Or the following if you need to switch controls from elsewhere:

    TestControl1 testControl = new TestControl1();
    ((UserControlContainer)Application.Current.RootVisual).SwitchControl(testControl);

If you find this useful or find any issues with this method, let me know so I can improve it for all.

 

Updated 2008-03-13: Added Application_Startup example. Thanks to Maurice for pointing this omission out.

[tags]Silverlight 2.0,code,example[/tags]