Posts
133
Comments
328
Trackbacks
0
November 2010 Entries
Part 2 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 #6)

What is it? Create a Notification Window in a Silverlight Out Of Browser Application.

Why do I care? Its a great way to alert users of something that needs their attention. It works similar to the notification you would get with a new email in Outlook. 

 How do I do it:

1) Make sure you are developing an OOB application. Right click on your Silverlight Project and make sure there is a check in “Enabled running application out of the browser” as shown below:

image

2) Add a button to your page and drop in the following code snippet.  This creates a very simple Notification, but you can add borders and more.

private void button1_Click(object sender, RoutedEventArgs e)
{
    NotificationWindow notify = new NotificationWindow();
    notify.Height = 100;
    notify.Width = 200;
    TextBlock text = new TextBlock();
    text.Text = "This is the Notification Message";
    text.Foreground = new SolidColorBrush(Colors.Red);
    notify.Content = text;
    notify.Show(3000);
}

3) Here is an example of what it looks like.

image

Tip/Trick #7)

What is it? You can increase isolated storage if you need more space. 

Why do I care? Eventually you will get a requirement that will call for more space than what is originally allocated by default.

How do I do it: This trick has to come from a Button click Event. So drop a button on the Silverlight Page and paste the following code inside of it.

Note: This code snippet came directly from MSDN.

private void button2_Click(object sender, RoutedEventArgs e)
{
    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
    {
        // 5 MB of isolated storage space is needed
        int spaceNeeded = 1024 * 1024 * 5;

        if (store.AvailableFreeSpace < spaceNeeded)
        {
            if (store.IncreaseQuotaTo(store.Quota + spaceNeeded))
            {
                // The user accepted the request
            }
        }
    }
}

When the user clicks the button the following dialog will appear.  If they click “Yes”, then it will increase Isolated storage.

SNAGHTML4bd9aa2

Tip/Trick #8)

What is it? Use the StringFormat in XAML to format your data (for example a Birthdate).

Why do I care? It allows you to use standard formatting expressions in XAML rather than put it in code behind. 

How do I do it: To format a string into a Birthdate then do the following: add a TextBlock to your main page.

<TextBlock x:Name="txtDOB" Text="{Binding DOB, StringFormat='MM/dd/yyyy'}"/>

Add a class to your project to hold the data. 

using System;

namespace SilverlightApplication16
{
    public class TestClass
    {
        public DateTime DOB { get; set; }
    }
}

Now add in the code to populate the TextBlock.

TestClass data; 

public MainPage()
{
    InitializeComponent();
    data = new TestClass() { DOB = new DateTime(1979, 5, 1) };
    txtDOB.DataContext = data;
}

Now when you run the application, your DOB has the following format:

image

If you do not format the data it would have looked like this:

image 

Pro Tip: http://www.csharp-examples.net/string-format-datetime/ has a lot of great StringFormat examples for DateTime.

Tip/Trick #9)

What is it? A simple way to change the Silverlight Page that starts when your application is launched.

Why do I care? When you are working on a Silverlight application and want to try different test without messing up your MainPage.xaml or if you want a different startup page to launch when your application is started. 

 How do I do it: Navigate to your App.xaml.cs and look for Application_Startup. You will want to modify the line highlighted below to point to the new Silverlight Page that you created. Make sure that you comment out the first line that points to MainPage() as shown below.

 image

Tip/Trick #10)

What is it? The GridSplitter control is actually a useful Silverlight control that isn’t talked about very much. 

Why do I care? Use the GridSplitter control to provide an easy way to resize rows/columns in a grid at run-time. Depending on the application, your users may like this. 

How do I do it: You can accomplish this by adding the following code into a Silverlight Page.

<navigation:Page x:Class="SilverlightApplication16.Page1" 
           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"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Page1 Page" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />

        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />

        </Grid.ColumnDefinitions>
        <Rectangle Fill="#FF2626D8" Margin="37,29,63,21" Stroke="Black"/>
        <Rectangle Fill="#FF52F519" Margin="60,29,40,21" Stroke="Black" Grid.Column="1"/>
        <Rectangle Fill="#FFFF3A00" Margin="37,25,63,25" Stroke="Black" Grid.Row="1"/>
        <Rectangle Fill="#FFE71EB2" Margin="60,25,40,25" Stroke="Black" Grid.Column="1" Grid.Row="1"/>
        <sdk:GridSplitter Grid.Column="1" HorizontalAlignment="Left" Margin="0,-9,0,0" Grid.RowSpan="2" Width="14" Background="Black"/>
        <sdk:GridSplitter Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Height="21" Margin="-12,0,8,-4" VerticalAlignment="Bottom" Background="Black"/>

    </Grid>
</navigation:Page>

See the arrows located below? You can resize the grid by clicking on the black space and dragging.

Before dragging:

 

 

 

 

 

 

SNAGHTML986cfbe

After Dragging:

SNAGHTML98861a1

Thanks for reading and please come back for parts 3 and 4.

alt Subscribe to my feed

 

Posted On Monday, November 29, 2010 6:27 AM | Feedback (2)
100 Blog Post related to Microsoft.NET Technology in the past year.

image

It’s hard to believe that I just finished my 100th blog post in the past year related to Microsoft.NET Technology. I started this blog on November 11th, 2009 and now 100 blog posts later I am still writing and loving it. This is not the first time that I started a technology blog, but the first time that it actually lasted. I will have to admit that I learned more from writing the articles then most did reading them. =) I sincerely hope that somehow I have assisted the community and helped a developer solve a problem. In the future, I plan to continue writing about Silverlight and Microsoft.NET technology.

If you are interested in keeping up with my blog on your WP7 Device, then click here and it will launch Zune where you can download it. It’s free so why not give it a shot? Again, Thank you for reading my blog. 

alt Subscribe to my feed

Posted On Wednesday, November 24, 2010 9:11 AM | Feedback (3)
Part 1 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 #1)

What is it? You can easily enable a visual Framerate counter inside your Silverlight Application. The end result looks like the image below:

 image

Why do I care? This should be used for profiling/performance testing of your Silverlight Application before you move it into production status.

 How do I do it: Simply add the following two lines inside your div tags:

<param name="enableFramerateCounter" value="True" />
<param name="enableGPUAcceleration" value="True" />

So your final div tag should look like the following (I’ve included the body tag):

<body>
    <!-- Runtime errors from Silverlight will be displayed here.
    This will contain debugging information and should be removed or hidden when debugging is completed -->
    <div id='errorLocation' style="font-size: small;color: Gray;"></div>

    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
            <param name="source" value="ClientBin/DropBoxDemo.xap"/>
            <param name="onerror" value="onSilverlightError" />
            <param name="background" value="white" />
            <param name="minRuntimeVersion" value="4.0.50826.0" />
            <param name="autoUpgrade" value="true" />
            <param name="enableFramerateCounter" value="True" />
            <param name="enableGPUAcceleration" value="True" />
            <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration: none;">
                <img src="http://go.microsoft.com/fwlink/?LinkID=161376" alt="Get Microsoft Silverlight" style="border-style: none"/>
            </a>
        </object><iframe id='_sl_historyFrame' style='visibility:hidden;height:0;width:0;border:0px'></iframe></div>
</body>

Tip/Trick #2)

What is it? You can clear isolated storage on your Silverlight application from the browser instead of through code. A surprising amount of people are not aware of this.

Why do I care? It’s easy to access and do without writing any code. It also can be easily accomplished by an end user.

How do I do it: Simply right-click your Silverlight Application and select Silverlight then click on the Application Storage tab. At the bottom of the tab, you can either delete an individual sites isolated storage or all sites.

SNAGHTMLff37f8e

Tip/Trick #3)

What is it? Inserting a line break inside of a TextBlock/TextBox.

Why do I care? You will need to insert a linebreak into a TextBlock or Textbox at some point...

How do I do it: You can do it inside of XAML or in code behind by reviewing the samples below:

Here is an example using XAML:

<TextBlock FontSize="24" Height="71" HorizontalAlignment="Left" Margin="12,12,0,0" Name="textBlock1" VerticalAlignment="Top" Width="229" >
    Hello, my name is <LineBreak/> Michael
</TextBlock>

image

You can also use any hexadecimal encoded value to represent a literal.

 <TextBlock Text="Hello, my name is &#x0a;Michael" FontSize="24" Height="71" HorizontalAlignment="Left" Margin="12,12,0,0" Name="textBlock1" VerticalAlignment="Top" Width="229" />

Another way is at runtime with the following code snippet: Do not use '@' in front of the string definition, it will not work!

private void button1_Click(object sender, RoutedEventArgs e)
{
    textBlock1.Text = "Line1\r\nLine2";
}

 

image

Tip/Trick #4)

What is it? Embedding fonts (not included with Silverlight) into your Silverlight Application.

Why do I care? You will have a customer at some point that wants a custom font. Blend 4 makes this very easy, just be sure you have the copyright to distribute the font. 

How do I do it: We are going to do it in Blend 4, because it is so easy. You can accomplish this in a matter of seconds and Blend does all the dirty work.

Let’s get started with a basic Silverlight project (refer to the numbers on each image).

1) This is a standard Silverlight Project file structure.

2) This is a TextBlock that we wish to change the font for.

3) This is where we are going to select a font to embed. Go ahead and select a font and put a check in the  “Embed” underneath the font.

image 

You will notice a couple of things just happened.

1) A new folder called Fonts was added and the actual Font TTF was placed inside of this directory.

2) A preview of the new Font.

3) The new Font selected with the “Embed” checkbox checked.

SNAGHTML2e67ecf0

After looking at the code behind, you will see the following XAML. Pay attention to the FontFamily. That was easy.

<Grid x:Name="LayoutRoot" Background="White">
     <TextBlock Height="80" Margin="22,30,0,0" Text="This is an example of a new font. " Width="235" FontFamily="/SilverlightApplication17;component/Fonts/Fonts.zip#Engravers MT"/>
</Grid>

Tip/Trick #5)

What is it? You can check and see if a user is connected to the internet and handle accordingly.

Why do I care? If a user has lost connection to the internet, your application need to alert the user and save the current state.

How do I do it: We are going to add an Eclipse and textbox to our main page and follow up with some C Sharp code-behind. Note: In order to do this, you may have to disable and enable your network connection for testing. You can do this by going to Network and Internet and Network Connection and selecting disable as shown below:

SNAGHTML2e7c235c

Just change your XAML to the following:

<StackPanel Orientation="Horizontal">
    <Ellipse Height="65" Name="ellipse1" Stroke="Black" StrokeThickness="3" Width="59" />
    <TextBlock FontSize="24" Height="65" Name="textBlock1"  Width="323" />
</StackPanel>

And your C# code-behind to the following:

public MainPage()
{
    InitializeComponent();
    NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
}

void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
{
    if (NetworkInterface.GetIsNetworkAvailable())
    {
        textBlock1.Text = "Network State: Connected";
        ellipse1.Fill = new SolidColorBrush(Colors.Green);
    }
    else
    {
        textBlock1.Text = "Network State: Disconnected";
        ellipse1.Fill = new SolidColorBrush(Colors.Red);
    }
}

You will get the following screens when you have a valid network connected.

image

You will get the following screens when you have disconnected from the network.

image

That is it for Part 1, just 5 Tips/Tricks for a Silverlight Developer. Hopefully, you will subscribe to my blog for the last three parts.

alt Subscribe to my feed

 

Posted On Monday, November 22, 2010 6:12 AM | Feedback (5)
Notes from Visual Studio Live! In Orlando November 14-17th.

image

I was lucky enough to attend Visual Studio Live! in Orlando on November 14th-17th. There were so many great speakers and the networking was great. I met a lot of really cool people and  we talked about everything .NET (from WP7, Silverlight, C#, ASP.NET WebForms, AJAX, MVC 3.. and so forth). I took a lot of notes during all the sessions and wanted to provide it to those that could not come out. If you follow me on Twitter then you have seen most of these. Most of the authors put slides/source code for their presentation on the web. So if you want to learn more you should be able to find the info by googling the author’s name. I met a lot of people at Visual Studio Live and had great conversations with many speakers like (Tim Huckaby, Billy Hollis, Wallace McClure, David Platt, Walt Ritscher).

Below are the sessions that I selected and the Key Points that I took away from the session.

Sunday Nov 13th.

Making Effective Use of Silverlight and WPF (Billy Hollis, DotNetMasters, Rockford Lhotka, Principal Technology Evangelist, Magenic)

Key Points:

Monday Nov 14th

Keynote Visual Studio 2010 The Best Path from Ideas to Solutions (Dave Mendlen, Senior Director, Developer Platform and Tools, Microsoft Corporation)

Key Points:

  • Lightswitch – Still in Beta. Easy for non-developers to create applications. (Developers have mixed feelings about this – actually they hate this.)
  • Lightswitch uses Silverlight and you can create simple database tables without knowing what Data Types are. (example: Phone number)
  • Here is the Visual Studio 2010 Feature Pack 2 announced at #vslive yesterday morning http://bit.ly/9DXMJL

What's new in ASP.NET 4 WebForms (Wallace McClure, Partner, Scalable Development, Inc)

Key Points:

ASP.NET MVC Quick Primer (Gus Emery, Principal, Tech-Pro)

Key Points:

  • I would highly recommend watching @SteveAndrews talk on MVC to supplement what you learned today http://mcrump.me/cxSuG3
  • Now included with .NET 4.0. No separate d/l needed.
  • VS2010 MVC template automatically ask if you want to create a unit test project #MVC #vslive
  • Controller – Intercepts all User Interactions.
  • Default Route is Home
  • This is not a brand new pattern created by Microsoft. It’s been around for a while.

WPF & Silverlight: Data Visualization, NUI, and Next Generation of User Experience (Tim Huckaby, CEO/Founder, InterKnowlogy)

Key Points:

  • Tim is using an old Acer Aspire Laptop to do 3D in WPF. This shows you just how hardware is becoming cheap.
  • Touch Capable computing devices are not new.
  • Tim says that we not that far away from “surface – touch apps” everywhere.
  • Showed a demo of surface app that reaches into a human heart.
  • Another demo of a doctor swiping his badge using Surface.
  • I just met Tim Huckaby @timhuckaby at #vslive. He's about to do a presentation on Data Visualization #silverlight #wpf

Tips & Tricks: Visual Studio 2010 IDE & Extensions (Chris Granger, Microsoft)

Key Points:

  • You can pin recent items inside of VS2010.
  • You can get new Project Templates online.
  • Extension Manager has lots of goodies like – Productivity Power Tools
  • VS2010 Supports multiple monitors (finally).
  • IntelliTrace debugging only works with VS2010 Ultimate.
  • Demoed finding a bug without setting breakpoints.

Tuesday Nov 15th

AJAX with the UpdatePanel, WebForms, and the AJAX Control Toolkit (Wallace McClure, Partner, Scalable Development, Inc)

Key Points:

Silverlight, WCF RIA Services, and Your Business Objects (Deborah Kurata, President, InStep Technologies, Inc.)

Key Points:

JQuery for ASP.NET Developers - Part 1 (Jeffrey McManus, CEO, Platform Associates)

Key Points:

 

Building RESTful Applications with the Open Data Protocol (Todd Anglin, Chief Evangelist, Telerik)

Key Points:

Can you use MEF too much? Hint - NO! (Jon Flanders, Senior Consultant, MCW Technologies)

Key Points:

  • MEF is a framework for creating loosely-coupled, extensible applications.
  • Most of VS uses it already.
  • Silverlight MEF - Extensible Applications http://mcrump.me/axqZrD
  • Export it, Import it, Compose it - MEF #vslive

 

Wednesday Nov 16th

Why Software Sucks (David S. Platt)

Key Points:

Design, Don't Decorate (Billy Hollis, DotNetMasters)

Key Points: 

  • Billy @billyhollis recommends developing several prototypes in parallel. #vslive
  • Billy @billyhollis says that he does not use SketchFlow for prototyping. #vslive
  • Process/Team Structure - Process must be design-centric rather than code-centric. #vslive
  • Billy @billyhollis says that you will have failed experiments! I say AMEN! #vslive
  • Billy @billyhollis says don't reuse prototypes hacks for your production version. #vslive

Using Microsoft Prism Loose - Coupling for Application Development (David S. Platt)

Key Points:

Multi-touch Madness! (Brian Peek, Senior Consultant, ASPSOFT, Inc.)

Key Points: 

Using WPF for Good and Not Evil (David S. Platt)

Key Points: 

  • Making your customers sick is not a recipe for success. Jeffrey Katzenberg #vslive
  • Users do not want to think about your software, they want to think about their tasks. #vslive
  • Motion Grab's a User's Eye - its hard for the user to look away from it. #vslive scrolling text...

Thanks to all for putting up with my Tweets during the past few days. I’ve added a lot of people to Twitter and hope that we continue having great conversations. See you next year (hopefully).

alt Subscribe to my feed

 

Posted On Wednesday, November 17, 2010 3:18 PM | Feedback (0)
Submitting a Windows Phone 7 Application to the Market.

This is the last post in a series of articles detailing the process of building/deploying a WP7 application. I’ve walked you through setting up the tools, to playing with the hardware to deploying your application to the actual hardware. Now I’m going to show you how to submit an app to the market. I’ve provided a link to all the articles mentioned below.

From start to finish with the final version of Visual Studio Tools for Windows Phone 7
Hands-on : Windows Phone 7 Review
Deploying your Windows Phone 7 Application to the actual hardware.
Profile your Windows Phone 7 Application for Free

OK, so you have followed my guide and are ready to submit your app to the marketplace. Let’s get started. To submit a Windows Phone 7 Application, you need to create an account first. You should already have one if you have followed my guides. After that, you should navigate over to http://create.msdn.com/en-US/. You will see the screen below and should click the Submit for Windows Phone.

image

It is a 5 step process, but it is very simple. Below is the first screen you will see when submitting your application to the marketplace.

Key things to note on Step 1:

  • The maximum size for a .xap is 400MB. That is a lot for an mobile application. Keep that in mind.
  • Your .xap file is usually located in the \Bin\Release or \Bin\Debug according to what you selected.
  • You can ask for a Technical exception on this screen. (For example: If you application needs to run in the background)

image

Key things to note on Step 2:

  • It’s very important that you write a detailed description on Step 2. This is what users will read when they decide to purchase your app or not.
  • Make sure you use as many keywords as possible for your app.
  • Give a support email address. You do not want your users spreading negative feedback about your app. If you fix it then chances are they will spread good news.
  • Notice that at the bottom of this screen it detects what capabilities are required by your app.

image

Key things to note on Step 3:

  • It’s really best to have someone that knows Paint.Net or Photoshop to create your app artwork. If you don’t have anyone then you can always do it yourself for free with Paint.net.
  • Pay attention to the sizes below. I had to fire open Paint.net and change mine to match exactly the dimensions they listed. (Even if its off .5% it will fail).

image

Key things to note on Step 4:

  • You can add if your application has a Trial mode here.
  • Make sure if you price your application greater than .99 cents, its worth it.
  • You can only submit 5 free applications per account.

image

Key things to note on Step 5:

  • You only have one option here and that is to automatically add it to the Marketplace after passing certification.

image

After you have submitted your application for publication, you can visit your app hub to see the status. Most of the Windows Phone 7 apps are being tested/approved within a few days.

image

That is all there is to it. A very simple process to submit your application to the marketplace. If your app fails testing, then Microsoft will send you an email detailing why. If my app fails, then I will document that process as well. Thanks for visiting and keep rocking Silverlight.

alt Subscribe to my feed

Posted On Tuesday, November 09, 2010 5:30 AM | Feedback (1)
Customize the Silverlight Installation Experience in about 15 Minutes

If you build Silverlight Applications, chances are you have seen this screen before. I’m talking about the default “To view this content, please install…” Screen shown below.

The Default Installation Screen.

image

This is the screen that your users see when they first visit your site without Silverlight installed. It’s just plain ugly and most users do not know what it means. Take this example below by Netflix, they have alerted the user with a friendly: “You’re almost ready to watch…” Install Now. This screen makes the user eager to install Silverlight because they want to watch the movie. This is a perfect example of why you should spend time customizing this screen.

image

I snagged this image from Google images which pulled it off of Tim Heuer’s great site.

We are going to build a screen that is stylish in about 15 minutes using the Sample Code Microsoft provided for us. To begin you are going to want to read the Silverlight Installation Experience White Paper and download the Sample Code.zip file.

Since you develop Silverlight Applications, you first need to disable the plug-in from your browser. I am using IE9 Beta at the moment and will show you how to disable it.

Click the Settings button first and then click on Manage add-ons:

image

You will want to find Microsoft Silverlight and disable it like shown below:

SNAGHTML239103a3

Now if you go to www.silverlight.net you should see the following screen:

image

 

 

 

 

 

Now that our browser thinks that Silverlight is not installed. It’s time to finish the job.

Extract the Installation Experience Sample Code to a folder and you will have the following directories:

image

We are going to copy the css and images folder from the WebAppInstall Folder onto our clipboard to paste later:image

Now that the files are copied, we are going to paste them into our Silverlight Project’s Web Folder.

image

At this point, you will need to add the stylesheets and images reference to either your .aspx or .html file. We are going to add it to our .html file.

<link href="css/slInstall.css"rel="stylesheet"type="text/css"/>
<link href="css/slInstallWide.css"rel="stylesheet"type="text/css"/>

You can go ahead and add the template below to the inside of your form tag, paying special attention to the div classes we are creating:

<form id="form1" runat="server" style="height:100%">
<div id="silverlightControlHost">
    <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
      <param name="source" value="ClientBin/SilverlightApplication7.xap"/>
      <param name="onError" value="onSilverlightError" />
      <param name="background" value="white" />
      <param name="minRuntimeVersion" value="4.0.50826.0" />
      <param name="autoUpgrade" value="true" />
     <div class="slInstall">
         <div class="slInstallPopupWide"style="margin-top: -182px; height: 363px">
             <div class="slPopupContentWide">
                 <div class="slScreenshotWide"><img src="images/wide/soccer.jpg"></div>
                         <div class="slTextContentWide">
                             <div class="slHeadlineWide">Michael Crump</div>
                             <div class="slDescription">
                             <p>Michael Crump is the developer of this fine demo.</p>
                             <p>He really enjoys building in Microsoft Silverlight and his hobbies include:</p>
                             <ul>
                             <li>Programming .NET</li>
                             <li>WP7</li>
                             <li>Film</li>
                             <li>Family</li>
                             </ul>
                             </div>
                             <img class="slDivider"src="images/wide/divider.png"style="display: block">
                             <a class="slButtonWide" href="http://go.microsoft.com/fwlink/?LinkID=149156"
                             style="display: block">GET STARTED NOW!</a>
                         </div>
                     </div>
                 <div class="slPopupTopWide"></div>
                 <div class="slPopupLoopWide"style="height: 17px"></div>
             <div class="slPopupBotWide"></div>
         </div>
     </div>
    </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
</form>

Now, when you load your site, it will have the following theme: (minus the good looking guy in the picture) 

image

This was accomplished in about 15 minutes. You can look at the code above and see that this was easily accomplished. A demo can be found here, but you will need to disable Silverlight in your add-on first. Full source can be found here.

Full source is located below:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
    <title>SilverlightApplication7</title>
    <style type="text/css">
    html, body {
        height: 100%;
        overflow: auto;
    }
    body {
        padding: 0;
        margin: 0;
    }
    #silverlightControlHost {
        height: 100%;
        text-align:center;
    }
    </style>

<link href="css/slInstall.css"rel="stylesheet"type="text/css"/>
<link href="css/slInstallWide.css"rel="stylesheet"type="text/css"/>

    <script type="text/javascript" src="Silverlight.js"></script>
    <script type="text/javascript">
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
              appSource = sender.getHost().Source;
            }
            
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;

            if (errorType == "ImageError" || errorType == "MediaError") {
              return;
            }

            var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "\n" ;

            errMsg += "Code: "+ iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";

            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError") {           
                if (args.lineNumber != 0) {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " +  args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }

            throw new Error(errMsg);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server" style="height:100%">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
          <param name="source" value="ClientBin/SilverlightApplication7.xap"/>
          <param name="onError" value="onSilverlightError" />
          <param name="background" value="white" />
          <param name="minRuntimeVersion" value="4.0.50826.0" />
          <param name="autoUpgrade" value="true" />
         <div class="slInstall">
             <div class="slInstallPopupWide"style="margin-top: -182px; height: 363px">
                 <div class="slPopupContentWide">
                     <div class="slScreenshotWide"><img src="images/wide/mike1.jpg"></div>
                             <div class="slTextContentWide">
                                 <div class="slHeadlineWide">Michael Crump</div>
                                 <div class="slDescription">
                                 <p>Michael Crump is the developer of this fine demo.</p>
                                 <p>He really enjoys building in Microsoft Silverlight and his hobbies include:</p>
                                 <ul>
                                 <li>Programming .NET</li>
                                 <li>WP7</li>
                                 <li>Film</li>
                                 <li>Family</li>
                                 </ul>
                                 </div>
                                 <img class="slDivider"src="images/wide/divider.png"style="display: block">
                                 <a class="slButtonWide" href="http://go.microsoft.com/fwlink/?LinkID=149156"
                                 style="display: block">GET STARTED NOW!</a>
                             </div>
                         </div>
                     <div class="slPopupTopWide"></div>
                     <div class="slPopupLoopWide"style="height: 17px"></div>
                 <div class="slPopupBotWide"></div>
             </div>
         </div>
        </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    </form>
</body>
</html>

alt Subscribe to my feed

Posted On Saturday, November 06, 2010 8:28 AM | Feedback (3)
Tag Cloud