Posts
133
Comments
328
Trackbacks
0
December 2010 Entries
Part 4 of 4 : Tips/Tricks for Silverlight Developers.

Part 1 | Part 2 | Part 3 | Part 4

I wanted to create a series of blog post that gets right to the point and is aimed specifically at Silverlight Developers. The most important things I want this series to answer is :

  • What is it? 
  • Why do I care?
  • How do I do it?

I hope that you enjoy this series. Let’s get started:

Tip/Trick #16)

What is it? Find out version information about Silverlight and which WebKit it is using by going to http://issilverlightinstalled.com/scriptverify/.

Why do I care? I’ve had those users that its just easier to give them a site and say copy/paste the line that says User Agent in order to troubleshoot a Silverlight problem. I’ve also been debugging my own Silverlight applications and needed an easy way to determine if the plugin is disabled or not.

How do I do it: Simply navigate to http://issilverlightinstalled.com/scriptverify/ and hit the Verify button. An example screenshot is located below:

Results from Chrome 7

image

Results from Internet Explorer 8 (With Silverlight Disabled)

image

Tip/Trick #17)

What is it? Use Lambdas whenever you can.

Why do I care?  It is my personal opinion that code is easier to read using Lambdas after you get past the syntax.

How do I do it: For example: You may write code like the following:

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    //Check and see if we have a newer .XAP file on the server
    Application.Current.CheckAndDownloadUpdateAsync();
    Application.Current.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(Current_CheckAndDownloadUpdateCompleted);

}

void Current_CheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
{
    if (e.UpdateAvailable)
    {

        MessageBox.Show(
            "An update has been installed. To see the updates please exit and restart the application");
    }
}

To me this style forces me to look for the other Method to see what the code is actually doing. The style located below is much easier to read in my opinion and does the exact same thing.

void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    //Check and see if we have a newer .XAP file on the server
    Application.Current.CheckAndDownloadUpdateAsync();
    Application.Current.CheckAndDownloadUpdateCompleted += (s, e) =>
    {
        if (e.UpdateAvailable)
        {

            MessageBox.Show(
                "An update has been installed. To see the updates please exit and restart the application");
        }
    };

}

Tip/Trick #18)

What is it? Prevent development Web Service references from breaking when Visual Studio auto generates a new port number.

Why do I care?  We have all been there, we are developing a Silverlight Application and all of a sudden our development web services break. We check and find out that the local port number that Visual Studio assigned has changed and now we need up to update all of our service references. We need a way to stop this.

How do I do it: This can actually be prevented with just a few mouse click. Right click on your web solution and goto properties. Click the tab that says, Web. You just need to click the radio button and specify a port number. Now you won’t be bothered with that anymore.

image

Tip/Trick #19)

What is it? You can disable the Close Button a ChildWindow.

Why do I care?  I wouldn’t blog about it if I hadn’t seen it. Devs trying to override keystrokes to prevent users from closing a Child Window.

How do I do it: A property exist on the ChildWindow called “HasCloseButton”, you simply change that to false and your close button is gone. You can delete the “Cancel” button and add some logic to the OK button if you want the user to respond before proceeding.

image

image

Tip/Trick #20)

What is it? Cleanup your XAML.

Why do I care?  By removing unneeded namespaces, not naming all of your controls and getting rid of designer markup you can improve code quality and readability.

How do I do it: (This is a 3 in one tip)

Remove unused Designer markup:

1)

Have you ever wondered what the following code snippet does?

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignWidth="640" d:DesignHeight="480"

This code is telling the designer to do something special with this page in “Design mode” Specifically the width and the height of the page. When its running in the browser it will not use this information and it is actually ignored by the XAML parser. In other words, if you don’t need it then delete it.

2)

If you are not using a namespace then remove it. In the code sample below, I am using Resharper which will tell me the ones that I’m not using by the grayed out line below. If you don’t have resharper you can look in your XAML and manually remove the unneeded namespaces.

image

3)

Don’t name an control unless you actually need to refer to it in procedural code. If you name a control you will take a slight performance hit that is totally unnecessary if its not being called.

<TextBlock Height="23" Text="TextBlock" />

 

That is the end of the series. I hope that you enjoyed it and please check out Part 1 | Part 2 | Part 3 if your hungry for more.

alt Subscribe to my feed

Posted On Friday, December 24, 2010 7:59 AM | Feedback (6)
Special thanks to everyone that helped me in 2010.

2010 has been a very good year for me and I wanted to create a list and thank everyone for what they have done for me.  I also wanted to thank everyone for reading and subscribing to my blog. It is hard to believe that people actually want to read what I write. I feel like I owe a huge thanks to everyone listed below. Looking back upon 2010, I feel that I’ve grown as a developer and you are part of that reason. Sometimes we get caught up in day to day work and forget to give thanks to those that helped us along the way. The list below is mine, it includes people and companies.

This list is obviously not going to include everyone that has helped, just those that have stood out in my mind. When I think back upon 2010, their names keep popping up in my head. So here goes, in no particular order. 

People

Dave Campbell – For everything he has done for the Silverlight Community with his Silverlight Cream blog. I can’t think of a better person to get recognition at the Silverlight FireStarter event. I also wanted to thank him for spending several hours of his time helping me track down a bug in my feedburner account.

Victor Gaudioso – For his large collection of video tutorials on his blog and the passion and enthusiasm he has for Silverlight. We have talked on the phone and I’ve never met anyone so fired up for Silverlight.

Kunal Chowdhury – Kunal has always been available for me to bounce ideas off of. Kunal has also answered a lot of questions that stumped me. His blog and CodeProject article have green a great help to me and the Silverlight Community.

Glen Gordon – I was looking frantically for a Windows Phone 7 several months before release and Glen found one for me. This allowed me to start a blog series on the Windows Phone 7 hardware and developing an application from start to finish that Scott Guthrie retweeted

Jeff Blankenburg – For listening to my complaints in the early stages of Windows Phone 7. Jeff was always very polite and gave me his cell phone number to talk it over. He also walked me through several problems that I was having early on.

Pete Brown – For writing Silverlight 4 in Action. This book is definitely a labor of love. I followed Pete on Twitter as he was writing it and he spent a lot of late nights and weekends working on it. I felt a lot smarter after reading it the first time. The second time was even better.

John Papa – For all of his work on the Silverlight Firestarter and the Silverlight community in general. He has also helped me on a personal level with several things.

Daniel Heisler – For putting up with me the past year while we worked on many .NET projects together in 2010.

Alvin Ashcraft – For publishing a daily blog post on the best of .NET links. He has linked to my site many times and I really appreciate what he does for the community.

Chris Alcock – For publishing the Morning Brew every weekday. I remember when I first appeared on his site, I started getting hundreds of hits on my site and wondered if I was getting a DOS attack or something. It was great to find out that Chris had linked to one of my articles.

Joel Cochran – For spending a week teaching “Blend-O-Rama”. This was my one of my favorite sessions of this year. I learned a lot about Expression Blend from it and the best part was that it was free and during lunchtime.

Jeremy Likness – Jeremy is smart – very smart. I have learned a lot from Jeremy over the past year. He is also involved in the Silverlight community in every way possible, from forums to blog post to screencast to open source. It goes on and on.

The people that I met at VSLive Orlando 2010. I had a great time chatting with Walt Ritscher, Wallace McClure, Tim Huckabee and David Platt.

Also a special thanks to all of my friends on Twitter like @wilhil, @DBVaughan, @DataArtist, @wbm, @DirkStrauss and @rsringeri and many many more.

Software Companies / Events / May of gave me FREE stuff. =)

Microsoft (3) –

  1. Microsoft reaching out to me with some questions regarding the .NET Community. I’ve never had a company contact me with such interest in the community.
  2. Having a contest where 75 people could win a $100 gift certificate and a T-Shirt for submitting a Windows Phone 7 app. I submitted my app and won.
  3. All of the free launch events this year (Windows Phone 7, Visual Studio 2010, ASP.NET MVC).

Wintellect – For providing an awesome day of free technical training called T.E.N. Where else can you get free training from some of the best programmers in the world? I also won a contest from them that included a NETAdvantage Ultimate License from Infragistics.

VSLive – I attended the Orlando 2010 Conference and it was the best developer’s conference that I have ever attended. I got to know a lot of people at this conference and hang out with many wonderful speakers. I live tweeted the event and while it may have annoyed some, the organizers of VSLive loved it. I won the contest on Twitter and they invited me back to the 2011 session of my choice. This is a very nice gift and I really appreciate the generosity.

BarcodeLib.com – For providing free barcode generating tools for a Non-Profit ASP.NET project that I was working on. Their third party controls really made this a breeze compared to my existing solution.

NDepend – It is absolutely the best tool to improve code quality. The product is extremely large and I would recommend heading over to their site to check it out.

Silverlight Spy – I was writing a blog post on Silverlight Spy and Koen Zwikstra provided a FREE license to me. If you ever wanted to peek inside of a Silverlight Application then this is the tool for you. He is also working on a version that will support OOB and Windows Phone 7. I would recommend checking out his site.

Birmingham .NET Users Group / Silverlight Nights User Group – It takes a lot of time to put together a user group meeting every month yet it always seems to happen. I don’t want to name names for fear of leaving someone out but both of these User Groups are excellent if you live in the Birmingham, Alabama area.

Publishing Companies

Manning Publishing – For giving me early access to Silverlight 4 in Action by Pete Brown. It was really nice to be able to read this awesome book while Pete was writing it. I was also one of the first people to publish a review of the book.
Sams Publishing and DZone – For providing a copy of Silverlight 4 Unleashed by Laurent Bugnion for me to review for their site. The review is coming in January 2011.

Special Shoutout to the following 3rd Party Silverlight Controls

It has been a great pleasure to work with the following companies on 3rd Party Control Giveaways every month. It always amazes me how every 3rd Party Control company is so eager to help out the community. I’ve never been turned down by any of these companies! These giveaways have sparked a lot of interest in Silverlight and hopefully I can continue giving away a new set every month. If you are a 3rd Party Control company and are interested in participating in these giveaways then please email me at mbcrump29[at]gmail[d0t].com.

The companies below have already participated in my giveaways:

Infragistics (December 2010) - Win a set of Infragistics Silverlight Controls with Data Visualization! 
Mindscape (November 2010) - Mindscape Silverlight Controls + Free Mega Pack Contest
Telerik (October 2010) - Win Telerik RadControls for Silverlight! ($799 Value)

Again, I just wanted to say Thanks to everyone for helping me grow as a developer.

alt Subscribe to my feed

Posted On Thursday, December 23, 2010 5:56 PM | Feedback (2)
Searching for the Perfect Developer’s Laptop.

I have been in the market for a new computer for several months. I set out with a budget of around $1200. I knew up front that the machine would be used for developing applications and maybe some light gaming. I kept switching between buying a laptop or a desktop but the laptop won because:

With a Laptop, I can carry it everywhere and with a desktop I can’t.

I searched for about 2 weeks and narrowed it down to a list of must-have’s :

  1. i7 Processor (I wasn’t going to settle for an i5 or AMD. I wanted a true Quad-core machine, not 2 dual-core fused together).
  2. 15.6” monitor
  3. SSD 128GB or Larger. – It’s almost 2011 and I don’t want an old standard HDD in this machine.
  4. 8GB of DDR3 Ram. – The more the better, right?
  5. 1GB Video Card (Prefer NVidia) – I might want to play games with this.
  6. HDMI Port – Almost a standard on new Machines. This would be used when I am on the road and want to stream Netflix to the HDTV in the Hotel room.
  7. Webcam Built-in – This would be to video chat with the wife and kids if I am on the road.
  8. 6-Cell Battery. – I’ve read that an i7 in a laptop really kills the battery. A 6-cell or 9-cell is even better.

That is a pretty long list for a budget of around $1200. I searched around the internet and could not buy this machine prebuilt for under $1200. That was even with coupons and my company’s 10% Dell discount. The only way that I would get a machine like this was to buy a prebuilt and replace parts.

I chose the  Lenovo Y560 on Newegg to start as my base. Below is a top-down picture of it.

image

 

Part 1: The Hardware

The Specs for this machine:

Color :  Gray
Operating System : Windows 7 Home Premium 64-bit
CPU Type : Intel Core i7-740QM(1.73GHz)
Screen : 15.6" WXGA
Memory Size : 4GB DDR3
Hard Disk : 500GB
Optical Drive : DVD±R/RW
Graphics Card : ATI Mobility Radeon HD 5730
Video Memory : 1GB
Communication : Gigabit LAN and WLAN
Card slot : 1 x Express Card/34
Battery Life : Up to 3.5 hours
Dimensions : 15.20" x 10.00" x 0.80" - 1.30"
Weight : 5.95 lbs.

This computer met most of the requirements above except that it didn’t come with an SSD or have 8GB of DDR3 Memory. So, I needed to start shopping except this time for an SSD. I asked around on twitter and other hardware forums and everyone pointed me to the Crucial C300 SSD. After checking prices of the drive, it was going to cost an extra $275 bucks and I was going from a spacious 500GB drive to 128GB. After watching some of the SSD videos on YouTube I started feeling better. Below is a pic of the Crucial C300 SSD.

IMG_0854

The second thing that I needed to upgrade was the RAM. It came with 4GB of DDR3 RAM, but it was slow. I decided to buy the Crucial 8GB (4GB x 2) Kit from Newegg. This RAM cost an extra $120 and had a CAS Latency of 7.

image

In the end this machine delivered everything that I wanted and it cost around $1300. You are probably saying, well your budget was $1200. I have spare parts that I’m planning on selling on eBay or Anandtech.  =) If you are interested then shoot me an email and I will give you a great deal mbcrump[at]gmail[dot]com.

  1. 500GB Laptop 7200RPM HDD
  2. 4GB of DDR3 RAM (2GB x 2)
  3. faceVision HD 720p Camera – Unopened

In the end my Windows Experience Rating of the SSD was 7.7 and the CPU 7.1. The max that you can get is a 7.9.

Part 2: The Software

I’m very lucky that I get a lot of software for free. When choosing a laptop, the OS really doesn’t matter because I would never keep the bloatware pre-installed or Windows 7 Home Premium on my main development machine. Matter of fact, as soon as I got the laptop, I immediately took out the old HDD without booting into it. After I got the SSD into the machine, I installed Windows 7 Ultimate 64-Bit. The BIOS was out of date, so I updated that to the latest version and started downloading drivers off of Lenovo’s site. I had to download the Wireless Networking Drivers to a USB-Key before I could get my machine on my wireless network. I also discovered that if the date on your computer is off then you cannot join the Windows 7 Homegroup until you fix it.

I’m aware that most people like peeking into what programs other software developers use and I went ahead and listed my “essentials” of a fresh build. I am a big Silverlight guy, so naturally some of the software listed below is specific to Silverlight. You should also check out my master list of Tools and Utilities for the .NET Developer. See a killer app that I’m missing? Feel free to leave it in the comments below.

My Software Essential List.

CPU-Z
Dropbox
Everything Search Tool
Expression Encoder Update
Expression Studio 4 Ultimate
Foxit Reader
Google Chrome
Infragistics NetAdvantage Ultimate Edition
Keepass
Microsoft Office Professional Plus 2010
Microsoft Security Essentials 2 
Mindscape Silverlight Elements
Notepad 2 (with shell extension)
Precode Code Snippet Manager
RealVNC
Reflector
ReSharper v5.1.1753.4
Silverlight 4 Toolkit
Silverlight Spy
Snagit 10
SyncFusion Reporting Controls for Silverlight
Telerik Silverlight RadControls
TweetDeck
Virtual Clone Drive
Visual Studio 2010 Feature Pack 2
Visual Studio 2010 Ultimate
VS KB2403277 Update to get Feature Pack 2 to work.
Windows 7 Ultimate 64-Bit
Windows Live Essentials 2011
Windows Live Writer Backup.
Windows Phone Development Tools

That is pretty much it, I have a new laptop and am happy with the purchase. If you have any questions then feel free to leave a comment below.

alt Subscribe to my feed

Posted On Saturday, December 18, 2010 6:45 PM | Feedback (8)
Part 3 of 4 : Tips/Tricks for Silverlight Developers.

Part 1 | Part 2 | Part 3 | Part 4

I wanted to create a series of blog post that gets right to the point and is aimed specifically at Silverlight Developers. The most important things I want this series to answer is :

  • What is it? 
  • Why do I care?
  • How do I do it?

I hope that you enjoy this series. Let’s get started:

Tip/Trick #11)

What is it? Underline Text in a TextBlock.

Why do I care? I’ve seen people do some crazy things to get underlined text in a Silverlight Application. In case you didn’t know there is a property for that.

How do I do it: On a TextBlock you have a property called TextDecorations. You can easily set this property in XAML or CodeBehind with the following snippet:

<UserControl x:Class="SilverlightApplication19.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock Name="txtTB" Text="MichaelCrump.NET" TextDecorations="Underline" />
    </Grid>
</UserControl>

or you can do it in CodeBehind…

txtTB.TextDecorations = TextDecorations.Underline;

 image

Tip/Trick #12)

What is it? Get the browser information from a Silverlight Application.

Why do I care? This will allow you to program around certain browser conditions that otherwise may not be aware of.

How do I do it: It is very easy to extract Browser Information out a Silverlight Application by using the BrowserInformation class.

image

You can copy/paste this code snippet to have access to all of them.

string strBrowserName = HtmlPage.BrowserInformation.Name;
string strBrowserMinorVersion = HtmlPage.BrowserInformation.BrowserVersion.Minor.ToString();
string strIsCookiesEnabled = HtmlPage.BrowserInformation.CookiesEnabled.ToString();
string strPlatform = HtmlPage.BrowserInformation.Platform;
string strProductName = HtmlPage.BrowserInformation.ProductName;
string strProductVersion = HtmlPage.BrowserInformation.ProductVersion;
string strUserAgent = HtmlPage.BrowserInformation.UserAgent;
string strBrowserVersion = HtmlPage.BrowserInformation.BrowserVersion.ToString();
string strBrowserMajorVersion = HtmlPage.BrowserInformation.BrowserVersion.Major.ToString();

Tip/Trick #13)

What is it? Always check the minRuntimeVersion after creating a new Silverlight Application.

Why do I care? Whenever you create a new Silverlight Application and host it inside of an ASP.net website you will notice Visual Studio generates some code for you as shown below. The minRuntimeVersion value is set by the SDK installed on your system. Be careful, if you are playing with beta’s like “Lightswitch” because you will have a higher version of the SDK installed. So when you create a new Silverlight 4 project and deploy it your customers they will get a prompt telling them they need to upgrade Silverlight. They also will not be able to upgrade to your version because its not released to the public yet.

How do I do it: Open up the .aspx or .html file Visual Studio generated and look for the line below. Make sure it matches whatever version you are actually targeting.

image

Tip/Trick #14)

What is it? The VisualTreeHelper class provides useful methods for involving nodes in a visual tree.

Why do I care? It’s nice to have the ability to “walk” a visual tree or to get the rendered elements of a ListBox. I have it very useful for debugging my Silverlight application.

How do I do it: Many examples exist on the web, but say that you have a huge Silverlight application and want to find the parent object of a control.  In the code snippet below, we would get 3 MessageBoxes with (StackPanel first, Grid second and UserControl Third). This is a tiny application, but imagine how helpful this would be on a large project.

<UserControl x:Class="SilverlightApplication18.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <StackPanel>
            <Button Content="Button" Height="23" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        </StackPanel>
    </Grid>
</UserControl>
private void button1_Click(object sender, RoutedEventArgs e)
{
    DependencyObject obj = button1;

    while ((obj = VisualTreeHelper.GetParent(obj)) != null)
    {
        MessageBox.Show(obj.GetType().ToString());
    }

}

Tip/Trick #15)

What is it? Add ChildWindows to your Silverlight Application.

Why do I care? ChildWindows are a great way to direct a user attention to a particular part of your application. This could be used when saving or entering data.

How do I do it: Right click your Silverlight Application and click Add then New Item. Select Silverlight Child Window as shown below.

SNAGHTML24f4fd05

Add an event and call the ChildWindow with the following snippet below:

private void button1_Click(object sender, RoutedEventArgs e)
{
    ChildWindow1 cw = new ChildWindow1();
    cw.Show();
}

 

 

 

image

Your main application can still process information but this screen forces the user to select an action before proceeding.

The code behind of the ChildWindow will look like the following:

namespace SilverlightApplication18
{
    public partial class ChildWindow1 : ChildWindow
    {
        public ChildWindow1()
        {
            InitializeComponent();
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            //TODO: Add logic to save what the user entered. 
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}

Thanks for reading and please come back for Part 4.

alt Subscribe to my feed

 

Posted On Monday, December 13, 2010 7:14 AM | Feedback (3)
Silverlight 4 – Coded UI Framework Video Tutorial

With the release of Visual Studio 2010 Feature Pack 2, Microsoft included the Coded UI Test framework. With this release it is possible to create automated test with just a few mouse clicks. This is a very powerful feature that all Silverlight developers need to learn. Instead of my normal blog post, I have created a video tutorial that walks you through it starting from “File” –> New Project. I hope you enjoy and please leave feedback.

Video Tutorial (short 9 minute video):

Slides from the demo (only 3):

Silverlight 4 – Coded UI Testing

Code for the MainPage.xaml that was used in the Demo. For the sake of time, I did not go into the AutomationProperties.Name that I used for the TextBox or Button. I added that for each element .

<Grid x:Name="LayoutRoot" Background="White" Height="100" Width="350">
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition/>
        <RowDefinition/>
    </Grid.RowDefinitions>
    <TextBlock Padding="15" Grid.Column="0" TextAlignment="Right">Name</TextBlock>
    <TextBox AutomationProperties.Name="txtAP" Grid.Column="1" Height="25" TextAlignment="Right" Name="txtName" />
    <Button AutomationProperties.Name="btnAP" Grid.Row="1" Grid.Column="1" Content="Click for Name"             x:Name="btnMessage" Click="btnMessage_Click" />
</Grid>

alt Subscribe to my feed

Posted On Saturday, December 11, 2010 7:49 PM | Feedback (3)
Silverlight 5 – What’s New? (Including Screenshots & Code Snippets)

image

Silverlight 5 is coming next year (2011) and this blog post will tell you what you need to know before the beta ships. First, let me address people saying that it is dead after PDC 2010. I believe that it’s best to see what the market is doing, not the vendor. Below is a list of companies that are developing Silverlight 4 applications shown during the Silverlight Firestarter. Some of the companies have shipped and some haven’t. It’s just great to see the actual company names that are working on Silverlight instead of “people are developing for Silverlight”.

image

The next thing that I wanted to point out was that HTML5, WPF and Silverlight can co-exist. In case you missed Scott Gutherie’s keynote, they actually had a slide with all three stacked together. This shows Microsoft will be heavily investing in each technology.  Even I, a Silverlight developer, am reading Pro HTML5.

image

Microsoft said that according to the Silverlight Feature Voting site, 21k votes were entered. Microsoft has implemented about 70% of these votes in Silverlight 5. That is an amazing number, and I am crossing my fingers that Microsoft bundles Silverlight with Windows 8.

Let’s get started… what’s new in Silverlight 5? I am going to show you some great application and actual code shown during the Firestarter event.

Media

image

  • Hardware Video Decode – Instead of using CPU to decode, we will offload it to GPU. This will allow netbooks, etc to play videos.
  • Trickplay – Variable Speed Playback – Pitch Correction (If you speed up someone talking they won’t sound like a chipmunk).
  • Power Management – Less battery when playing video. Screensavers will no longer kick in if watching a video. If you pause a video then screensaver will kick in.
  • Remote Control Support – This will allow users to control playback functions like Pause, Rewind and Fastforward.
  • IIS Media Services 4 has shipped and now supports Azure.

Data Binding

image

Layout Transitions – Just with a few lines of XAML you can create a really rich experience that is not using Storyboards or animations.

<VisualStateManager.LoadTransition>
    <LoadTransition StartXOffset="300" GeneratedDuration="0:0:1.0" StartOpacity="0.2">
       <LoadTransition.GeneratedEasingFunction>
        <CircleEase/>
        </LoadTransition.GeneratedEasingFunction>
    </LoadTransition>
</VisualStateManager.LoadTransition>

RelativeSource FindAncestor – Ancestor RelativeSource bindings make it much easier for a DataTemplate to bind to a property on a container control.

<ComboBox ItemTemplate={StaticResource BookItemTemplate} 
ItemsSource="{Binding DataContext.Book, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}"/>

Custom Markup Extensions – Markup extensions allow code to be run at XAML parse time for both properties and event handlers. This is great for MVVM support.

<ListBox SelectionChanged="{MyTestMethodBinding:Invoke Method=OnSelectCategory}"/>

Changing Styles during Runtime By Binding in Style Setters – Changing Styles at runtime used to be a real pain in Silverlight 4, now it’s much easier. Binding in style setters allows bindings to reference other properties.

<Style x:Key="AccentBlocks" TargetType="Rectangle">
   <Setter Property="Fill" Value="{Binding MyBrush, Source={StaticResource MyColorSettings}"/>
</Style>

XAML Debugging – Below you can see that we set a breakpoint in XAML. This shows us exactly what is going on with our binding. 

image

WCF & RIA Services

image

  • WS-Trust Support – Taken from Wikipedia: WS-Trust is a WS-* specification and OASIS standard that provides extensions to WS-Security, specifically dealing with the issuing, renewing, and validating of security tokens, as well as with ways to establish, assess the presence of, and broker trust relationships between participants in a secure message exchange.
  • You can reduce network latency by using a background thread for networking.
  • Supports Azure now.

 Text and Printing

image

  • Improved text clarity that enables better text rendering.
  • Multi-column text flow, Character tracking and leading support, and full OpenType font support. 
  • Includes a new Postscript Vector Printing API that provides control over what you print .
  • Pivot functionality baked into Silverlight 5 SDK.

Graphics

image

  • Immediate mode graphics support that will enable you to use the GPU and 3D graphics supports.

Take a look at what was shown in the demos below.

1) 3D view of the Earth – not really a real-world application though.

image

A doctor’s portal. This demo really stood out for me as it shows what we can do with the 3D / GPU support.

image

image

Out of Browser

image

  • OOB applications can now create and manage childwindows as shown in the screenshot below. 
  • Trusted OOB applications can use P/Invoke to call Win32 APIs and unmanaged libraries. 
  • Enterprise Group Policy Support allow enterprises to lock down or up the sandbox capabilities of Silverlight 5 applications.

In this demo, he tore the “notes” off of the application and it appeared in a new window. See the black arrow below.

image

In this demo, he connected a USB Device which fired off a local Win32 application that provided the data off the USB stick to Silverlight.

image

Another demo of a Silverlight 5 application exporting data right into Excel running inside of browser.

image

Testing

image

  • They demoed Coded UI, which is available now in the Visual Studio Feature Pack 2. This will allow you to create automated testing without writing any code manually.

Performance:

image

  • Microsoft has worked to improve the Silverlight startup time.
  • Silverlight 5 provides 64-bit browser support. 
  • Silverlight 5 also provides IE9 Hardware acceleration.

 

I am looking forward to Silverlight 5 and I hope you are too. Thanks for reading and I hope you visit again soon.

alt Subscribe to my feed

Posted On Monday, December 06, 2010 6:26 AM | Feedback (6)
Pimp my Silverlight Firestarter

So Silverlight Firestarter is over and your sitting on your couch thinking… what now? Well its time to


image

So how exactly can you pimp the Silverlight Firestarter? Well read below and you will find out:

1) Pimp the videos: First we are going to use a program named Juice to download all of the Silverlight Firestarter videos.

Go ahead and point your browser to http://juicereceiver.sourceforge.net/ and download the application. It works on Mac, Linux and PC. After it is downloaded you are going to want to add an RSS feed by clicking the button highlighted below.

SNAGHTML1fab39f9

At this point you are going to want to add the following URL inside the textbox and hit Save:

http://channel9.msdn.com/Series/Silverlight-Firestarter/RSS

SNAGHTML1fac4ef0

This RSS feed includes all the Silverlight Firestarter Labs and Presentations located below.

The Future of Silverlight

Data Binding Strategies with Silverlight and WP7

Building Compelling Apps with WCF using REST and LINQ

Building Feature Rich Business Apps Today with RIA Services

MVVM: Why and How? Tips and Patterns using MVVM and Service Patterns with Silverlight and WP7

Tips and Tricks for a Great Installation Experience

Tune Your Application: Profiling and Performance Tips

Performance Tips for Silverlight Windows Phone 7

Select all the videos and click the Download button located below (has blue arrow):

SNAGHTML1fb2653e

Once all the videos are downloaded you will have about 4.64GB of Silverlight fun. You can now move these videos to your MediaServer and watch them with whatever device you want. Put it on an iPad, iPhone.. emm wait I mean WP7 or WMC7. 

image

2) Pimp the Training Material – Download the offline installer for the labs here. This will give you almost a gig of free training materials.

SNAGHTML1fb8607d

Here is the topics covered:

Level 100: Getting Started
Level 200: Ready for More
Level 300: Take me Further

You will notice that it install Firestarter to the default of C:\Firestarter. So you will have to navigate to that folder and double click on Default.htm to get started. Now if you followed part one of the pimping guide then you will already have all the videos on your pc.

SNAGHTML1fbb7f05

You will notice that once you go into the lab you will get a Lab Document and Source at the bottom of the article.

image

Now instead of opening the Source Folder in a web browser you can just copy the folder C:\Firestarter\Labs into your Visual Studio 2010 Project Folder. This will save a lot of time later.

SNAGHTML1fbfae00

 

3) Pimp my Silverlight 5 Knowledge – Always keep reading as much as possible and remember that the Silverlight 5 Beta should come Q1 of 2011 and the final release at the end of 2011. Here are 5 great blog post on Silverlight 5.

Thats all that I got for now. Have fun with all the new Silverlight content.

alt Subscribe to my feed

Posted On Friday, December 03, 2010 8:29 PM | Feedback (1)
Tag Cloud