Silverlight for the MySpace Developer Platform

Now you can build Silverlight applications for the MySpace Developer Platform!  I have been working with MySpace for months on this initiative and now we have some exciting results:

  1. MySpace has just announced support for Silverlight on MySpace’s Open Platform.  Take a look at their new page about Silverlight support.
  2. On Thursday, April 2, MySpace and Microsoft will jointly release a kit on the CodePlex Open Source site (with the MS-PL License) that will make it easy for developers using Visual Studio and designers using Expression Blend to create Silverlight applications on MySpace’s OpenSocial-based developer platform.
  3. Along with Max Newbould, Development Manager for OpenSocial on MySpace, I will be giving a presentation at the Web 2.0 Expo in San Francisco on Thursday, April 2 at 1:30 PM on this Silverlight Kit for MySpace.  The kit should be available on CodePlex at the conclusion of the session.

As the MySpace Developer Platform grows and evolves, we want to keep Silverlight as a relevant option for designers and developers who want to create engaging, interactive application for MySpace users.  Working with developers at MySpace we’ve created a kit that would let designers with Expression Blend use data binding in Silverlight to connect to the data provided by the MySpace Developer Platform.  We’ve even added design-time and offline sample data to the kit to aid in development.

In this example below, I’m data binding the MySpace page owner’s friends to a ListBox and using a data template for each item returned:

image

And the XAML for this simple application is this (no code has been added to the application):

  • Key elements to look for are the <MyOpenSpace:MySpacePeopleRequest in the UserControl.Resources, the ListBox.ItemsSource, and the PeopleTemplate DataTemplate.
 <UserControl x:Class="Test_Silverlight_Kit_for_MySpace.Page"
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:MyOpenSpace="clr-namespace:MyOpenSpace;assembly=MySpaceSilverlightKit"
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300">
    <UserControl.Resources>
        <MyOpenSpace:MySpacePeopleRequest x:Key="OwnerFriends" 
            IdSpec="opensocial.IdSpec.PersonId.OWNER" />
        <DataTemplate x:Key="PersonTemplate">
            <Border ToolTipService.ToolTip="{Binding Path=Status}" Height="Auto" Width="Auto" 
             Padding="4,4,4,4" CornerRadius="4,4,4,4" BorderBrush="#FF000000" BorderThickness="0,0,2,2">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFFFFFF" Offset="0"/>
                        <GradientStop Color="#FF007EE8" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>
                <Grid Height="Auto" Width="Auto">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Image Source="{Binding Mode=OneWay, Path=ThumbnailImage}" Width="100" Height="100" HorizontalAlignment="Stretch" Margin="2.5,2.5,2.5,2.5"/>
                    <HyperlinkButton TargetName="_blank" NavigateUri="{Binding Path=ProfileUrl}" Grid.Row="1" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Padding="0,0,0,0">
                        <TextBlock Foreground="#FFFFFFFF" Text="{Binding Path=Nickname}" TextWrapping="Wrap" FontFamily="Trebuchet MS" FontSize="10" Height="Auto" Width="Auto" TextAlignment="Center"/>
                    </HyperlinkButton>
                </Grid>
            </Border>
        </DataTemplate>

    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox 
            ItemTemplate="{StaticResource PersonTemplate}"
            ItemsSource="{Binding People, Source={StaticResource OwnerFriends}}"/> 
    </Grid>
</UserControl>

I can’t wait to see what cool applications people build with this kit.  Watch (or subscribe) this blog for more news.