Seasonal Savings: 20% off selected memberships for a limited time. Give now

Learn it fast with expert-taught software and skills training at lynda.com. See what you can learn

By David Gassner | Wednesday, April 11, 2012

Building applications for Microsoft operating systems

We recently released Silverlight 5 Essential Training, with Walt Ritscher. If you’re new to Silverlight, check out this overview of the plug-in from chapter one of the course:

If you’re a developer who’s interested in working with Microsoft operating systems such as Windows 7, Windows Phone, or the upcoming Windows 8, you might wonder why this course might be important. After all, Silverlight, like Adobe’s Flash Player, is a web browser plug-in. You should be interested because many mobile devices, such as the iPhone or iPad, can’t display content built for these technologies, and Microsoft has made it clear that Silverlight apps won’t  be able to run across all modes of Internet Explorer when Windows 8 is delivered.

Fortunately, the skills you have acquired to build Silverlight applications are directly transferable to some new and important application platforms. Silverlight applications are created with a combination of XAML (eXtensible Application Markup Language) and your choice of either C#, or Visual Basic. (In his Silverlight 5 Essential Training course, Walt Ritscher focuses exclusively on C#, since it’s the more popular of the two languages.) Wondering how it all ties together? The same languages—XAML, C#, and Visual Basic—are all at the core of Microsoft’s developer platforms of the future: Windows Phone and Windows 8.

Consider the following XAML code snippet that declares a page control in a Silverlight application:

<usercontrol x:class="”SilverlightApp.MainPage”" xmlns="”http://schemas.microsoft.com/winfx/2006/xaml/presentation”" xmlns:x="”http://schemas.microsoft.com/winfx/2006/xaml”" …more="" xml="" namespaces…="" mc:ignorable="”d”" d:designheight="”300″" d:designwidth="”400″">
  <grid x:name="”LayoutRoot”" background="”White”" width="”300″" height="”200″">    
    <textblock height="”23″" horizontalalignment="”Left”" margin="”10,10,0,0″" text="”Hello" world”="" verticalalignment="”Top”"></textblock>
  </grid>
</usercontrol>

The code in bold font defines the layout and presentation of a single line of text: “Hello World.” Now here’s a page control for a Windows 8 Metro app; notice that the bolded code looks almost exactly the same:

pre class=’line-numbers’ data-line=’6-8′><page x:class="Win8App.MainPage"></page><br> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br> ...more XML namespaces...<br> mc:Ignorable="d"><br> <grid background="{StaticResource ApplicationPageBackgroundBrush}><br /> <TextBlock HorizontalAlignment=" left"="" margin="10,10,0,0" textwrapping="Wrap" text="Hello World!" verticalalignment="Top" fontsize="36"></grid><br> <br>

And here’s a page control for Windows Phone:

<phone:phoneapplicationpage x:class="PhoneApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...more="" xml="" namespaces="" and="" properties...="">
*  <grid x:name="ContentPanel" grid.row="1" margin="12,0,12,0">
*  <textblock height="30" horizontalalignment="Left" margin="10,10,0,0" *=""   text="Hello World" verticalalignment="Top"></textblock>
*  </grid>
</phone:phoneapplicationpage>

These component definitions are all built with XAML, and use pretty much the same syntax to display text on the screen. They have different root elements: UserControl for Silverlight, Page for Windows 8, and PhoneApplicationPage for Windows Phone. But they all support the same basic set of visual controls such as Grid and TextBlock, and they all use “code-behind” architecture to bind logic written in C# or Visual Basic to visual presentation defined in XAML.

The bottom line is, you can’t just move an existing Silverlight or Windows Phone application to Windows 8 and expect it to work. The underlying technologies are different, and there are differences between the application programming interfaces (APIs) for the different operating systems. You’ll have to “port your application," a process that involves creating new code files and copying selected portions of code to the new version of the application. You’ll probably also have to re-imagine the user interface for the new target OS, since applications written for a browser have different layout guidelines from those on a phone or tablet, or those designed to run full-screen in high resolution as they might on a Windows 8 desktop. If you already know how to use XAML and other .NET programming languages, learning how to build Windows 8 apps will be much faster and easier.

In this video from chapter three of the Silverlight 5 course, Walt explores the programming side of Silverlight 5 and discusses the relationship between XAML and .NET:

In the near future, we’ll be releasing courses on both Windows Phone and Windows 8 application development. If you want to learn some of the skills you’ll need right now, Walt Ritscher’s Silverlight 5 Essential Training course is a good place to start, along with his Visual Studio 2010 Essential Training, and Joe Marini’s C# Essential Training. You can use Microsoft’s free express versions of Visual Studio or a full copy of Visual Studio as your development environment. When you're ready to get started with Windows 8, which is currently available as a free Consumer Preview, you can use a Beta version of Visual Studio that lets you build your first Metro apps right away.

Microsoft has put a lot of effort into making development skills and programming languages transferable across their multiple operating systems and application platforms; these efforts make it easier to learn, and easier to build applications for, their current and future technologies.

Interested in more?

Suggested courses to watch next:

Learn it from the experts.

With online video courses at lynda.com, you can reach your goals faster. Learn software, improve your skills, and get an inside look at how the professionals work.

See what you can learn


Share this article:

Tags: , , ,

Get the latest news

  •   New course releases
  •   Pro tips and tricks
  •   News and updates
  
New releases submit clicked

You can change your email preferences at any time. We will never sell your email. More info

Featured articles

A lynda.com membership includes:

Unlimited access to thousands of courses in our library
Certificates of completion
New courses added every week (almost every day!)
Course history to track your progress
Downloadable practice files
Playlists and bookmarks to organize your learning
Become a member

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.