This video series will help aspiring Windows Phone 7 developers get started. We’ll start off with the basics and work our way up so in a few hours, you will know enough to build simple WP7 applications, such as a GPS aware note taking application. We’ll walk you through getting the tools, knowing what an if statement is, to using the GPS built into the phone and much more!
This series is organized into 4 days’ worth of material:
This video provides a quick introduction to what you can expect from this video series, explaining the rationale for the organization of information presented, how to get the most out of the videos, and an overview of the project.
In this brief video, Bob demonstrates where to download and how to install Visual Studio 2010 Express for Windows Phone. Additionally, he provides high-level explanations of the additional tools installed to your computer.
This video demonstrates how to use Visual Studio 2010 Express for Windows Phone to add Silverlight controls to a new project. It also covers how to write C# code that executes and displays a simple message on the phone emulator’s screen when a user clicks a button in your application. Later, Bob will answer the questions, “why did we do that?” and “how does this work?” in order to give you a deeper look into the significance of each step he took along the way.
Having built a simple application, Bob takes you on a tour of the Windows Phone 7 Emulator: the software that mimics the real phone’s operating system so you can visualize how your application will behave once it is installed on a real phone device. He demonstrates how to re-orient the phone, using the three buttons, modifying phone emulator settings, and more.
Now that you’ve written your first application and you’re familiar with the emulator, Bob explains the C# syntax he wrote earlier on in the series. He shows the connection between the project’s.xaml files and.xaml.cs files, and provides a high-level explanation of what XAML is. By the end of this video you should have a general idea of the overall process of building an application and be able to see all the parts working together.
In this video Bob deepens your understanding of the relationship between the files in your application. He shows how to delete the MainPage.xaml and it’s code-behind, and adds a new Silverlight file to the project, re-creating the Hello World example. He also explains the purpose of the WMAppMainifest.xml file and modifies the DefaultTask to point it toward the new version of our Silverlight page.
This video covers the Visual Studio 2010 Express for Windows Phone Integrated Development Environment (IDE). Bob demonstrates debugging features such as setting break points to temporarily pause the execution of the code so you can peek at values and watch the reaction of the application as each line of code executes. He explains how to use code comments, utilize and benefit from Intellisense, navigate through your C# code using code rollups, add line numbers through the Tools | Options dialog, and more.
This video examines how to create a new project, how to open an existing project, how to close the project, and more. Bob shows where on your computer your project’s code resides, and explains how your code is compiled into a .xap file, the contents of a .xap file, and how that file is then copied to the Windows Phone 7 emulator.
We now focus on learning the C# programming language. In this video, Bob explains variables and data types, as well as setting and retrieving variable values.
This video shows the Silverlight control properties and how those properties can be used to set and retrieve attributes of the object (such as the Text attribute) or, rather, the control. Beyond the use of the TextBox control, understanding how properties can be set and retrieved on objects is an important building block as we begin to learn more about classes and objects.
The “if” statement allows us to add logic to our code, execute one code block if a certain condition exists, or execute a different code block if a certain condition doesn’t exist. This video examines simple usage as well as more complex “if” statements.
Much like human languages, programming languages have their own nouns, verbs, and other parts of speech. This video explains how operators and expressions are combined to create valid, well-formed statements that can be compiled and executed by the .NET Framework Runtime.
Picking back up on the notion of adding logic to your code, we look at a second decision statement—the switch—and compare its usefulness to the “if” statement we previously looked at.
When working with data or objects (such as controls) in applications, you often need to loop or, rather, iterate through groups. This video explains how to work with a simple “for iteration” statement. Since we’ll be working with lots of different groups (such as collections of objects and collections of data) we’ll need to understand a little about how to navigate through the collection, or list, of those items.
As Bob has already said several times throughout Day 1, methods are simply named blocks of code. Since methods have names, you can call them by name and their code blocks will execute. This video explains when to do this, how to create and call the method, and how to both pass values into a method and retrieve values from a method.
Congratulations! You’ve learned the basics. Now it’s time to flex your newfound knowledge, borrow from the concepts you’ve learned thus far, and write a simple application. You’ll save the world by allowing a mobile user to type in a special sequence of numbers every 108 minutes. If you get stuck, watch just enough of the next video to get un-stuck.
Got stuck with the homework assignment? No worries, simply watch enough of the solution video to get un-stuck, OR compare your solution with Bob’s version. IMPORTANT: before you peek at this video, please—for your own sake—try to complete this homework assignment on your own. You’ll only learn through practice, frustration, and exploration.
Since you’ll often be working with user-inputted data when writing Silverlight applications for the Windows Phone 7, Bob walks you through some common String manipulation features of the .NET Framework Class Library’s String class and StringBuilder class to help you parse, format, manipulate, concatenate and evaluate string data.
When working with Silverlight applications for the Windows Phone 7, you’ll often need to work with a date and/or time. This video demonstrates how to work with the DateTime class and TimeSpan class to add dates, calculate differences in time, retrieve parts of a DateTime object, format for display, and more.
Practically all work in C# and Silverlight applications involves classes, so in this video we examine the basics of classes, including how classes are defined, their major parts, and how to create new class instances while generally discussing how to work with classes in your applications.
Continuing the theme from the previous video, here we examine how to utilize classes that have been built by Microsoft and added to the .NET Framework Class Library (FCL, also known as the Base Class Library or BCL), a “library” of classes with methods and properties to handle virtually every low-level task involving your interaction with the display, use of memory, use of the network, the phone’s built-in capabilities, such as GPS, the phone’s flash drive, and more. Bob explains topics including, how to think about the Class Library as “bundles of related functionality,” how to work with Static classes and methods.
Up until now we’ve avoided discussing some parts of the C# code we’ve been working with. In this video, however, we begin discussing Namespaces, including how they are part of projects, how they’re used to avoid naming collisions between classes, and how to utilize using statements to create a shortcut in your code.
You will often need to work with groups of instances of classes and this video explains how to use one collection—the List—to keep references to multiple instances of a given class. Bob demonstrates how to add instances of objects to a collection and how to iterate through each instance inside the collection using the “for each” statement, a variation on the “for iteration” statement we learned about on Day 1.
Since C# 3.0, a new, shortened syntax used to create an instance of a new class and set its properties (initialization) all in one line of code became popularized. Entire collections can be created and initialized in this manner as well. Since many code examples on MSDN and the Internet at large use this new syntax, and because it is very convenient, Bob demonstrates how to dramatically shorten your code while explaining how to understand object and collection initializers.
It’s time to move past C# for adding logic and back to working with XAML to create Silverlight user interfaces. This video walks you through the XAML Designer Window, including both the Design and Code panes, for building your application’s user interface. Virtually every button and hidden feature is briefly revealed so you can easily navigate this important view into your application.
XAML is a language that allows you to declare new instances of classes and set their properties using an XAML (tag-like) syntax. While it has utility beyond Silverlight applications, XAML is used by Silverlight to define objects and properties that are displayed on screen. This video examines the default XAML that is created by adding a new project or Silverlight file. Additionally, it covers the XAML that is automatically created by dragging and dropping instances of Silverlight controls from the Toolbox to the XAML designer surface.
This video examines the three Layout Controls—Canvas, StackPanel, and Grid—and how to work with each one to define the layout of your Silverlight Phone application. Bob discusses the pros and cons of using each control and the syntax required to effectively use them.
This video demonstrates the connection between an instance of a class as defined in an XAML page with the event handler code that is defined in the C# class file. Bob also discusses how two controls can use the same event handler, how to retrieve and utilize the input parameters to the event handler code to determine which control fired the event, and more.
In this video, Bob takes you on a tour of the most popular Silverlight Input controls available for your Windows Phone 7 applications. He also shows you the important properties and events of each control. Controls include the PasswordBox, CheckBox, RadioButton, ListBox, and the ScrollViewer. Additionally, Bob makes the case for forcing yourself to write the XAML instead of relying on the Toolbox and Properties window as a means of helping you learn more about XAML and the controls.
Congratulations! You’re halfway through this video series. We’ve covered a lot of ground in two days and now is your chance to apply those concepts while building a real application. You’ll create a user interface for a spy application that allows your users to keep track of secret agents in the field. You’ll also be asked to create a custom class and set the properties of the class, then call a method on that class. If you get stuck, watch just enough of the next video to get un-stuck.
Got stuck with the homework assignment? No worries, simply watch enough of the solution video to get un-stuck, OR compare your solution with Bob’s version. This video (Part 1 of a two video sequence), demonstrates the part of the homework assignment that tasked you with building the user interface. IMPORTANT: before you peek at this video, please—for your own sake—try to complete this homework assignment on your own. You’ll only learn through practice, frustration, and exploration.
This video, (Part 2 in the two video sequence solving the Day 2 Homework Assignment) demonstrates the part of the homework assignment that tasked you with building a custom class including properties that you fill when a user submits the data. Also, you’ll call a method on that new class to “save” the data. Again, please try to get as far as possible on your own BEFORE watching this video.
To begin Day 3, you’ll work with the Image control to add images to your applications. You’ll see the visual tools inside of the IDE that make it easy to add images, and you’ll learn about the settings you can apply to the images to ensure that they are correctly included in your deployable .xap file.
In this video, Bob explains how to define reusable definitions for brushes (color, gradients, and images) throughout either a single page or the entire site, as well as how to combine collections of name / value pairs for a given control in order to give your application a consistent look and feel.
Most applications—even simple ones—will require at least two or more Silverlight pages. This video demonstrates how to navigate from one Silverlight page to another, as well as how to pass information between two pages using QueryStrings. Finally, Bob explains how to use the phoneAppService.State to save important values in case the user wants to navigate back to a page and expects to see the data and control property settings as they were previously set.
The application bar allows each page in your Silverlight Phone application to display up to four icons along the bottom, and this group of icons can be expanded to display a list of menu commands. This video demonstrates how to uncomment out the Application Bar template on a new Silverlight Phone page, how to add / remove and set the properties of buttons and menu commands, and how to respond to click events for each of those items.
While the canvas can be used to lay out controls on a page, it can serve double-duty and be hidden / shown to simulate a dialog box in your Windows Phone 7 applications. Bob demonstrates the technique used to show and hide a canvas that contains other controls, using C# code to set the Visibility property to either Hidden or Visible.
Each Windows Phone 7 application is allocated space on the phone’s flash drive where it can store information in a solitary area that cannot be accessed by other applications. The application can save any type of file or data here. In this video, Bob demonstrates how to utilize this feature to create new files or open existing files (like text files), read them, and display their information on the Phone’s display.
In a continuation of the previous video, Bob demonstrates how to read a list of file names saved to the phone’s flash drive and display those names in a ListBox. Each file name is displayed in a DataTemplate that contains a HyperlinkButton. This results in one Hyperlink button for each file name. Bob then demonstrates how to pass the file name in the QueryString to a second Silverlight page that allows the user to view the contents of the file.
How does your application respond when a user clicks the Start button or Back button on Windows Phone 7? In this video, Bob explains the difference between the Launched, Activated, Closed, and Deactivated events, how your application can be notified via event handlers in the App.xaml.cs code-behind file, and how to take that opportunity to save the current state of the application. Then, once the user has re-launched the applications, the state information can be retrieved and the state of the application from the previous session can be restored. Bob also explains how a special feature of Isolated Storage called IsolatedStorageSettings can provide an easy way to save name / value pair information without having to create and access a text file.
The Windows Phone 7 includes dozens of input scopes, also known as specialized keyboards that enable users to type in web addresses, chat messages, addresses, and more. Each input scope is tailored to make the given operation easier. Bob shows how to declare an input scope for an input control (like a TextBox) so that you can display the right input scope for the job.
Each Windows Phone 7 includes a Global Positioning System (GPS) that allows the phone to determine the latitude and longitude of the device. In this video, we first look at a special part of the Windows Phone 7 API to access the Geo Location information. Then, once we have the coordinates, we call a Web Service—a “method hosted on a web server,” which when given the coordinates will return the city, state, and country names—and we use this to display the location of the device on screen.
In the final instructional video for Day 3, Bob covers several topics, such as using an Image for the background of a Silverlight page, how to set the supported orientations for a page, and how to use the rectangle object to provide a slightly opaque black background that allows white text to pop out from an otherwise low contrast image.
Congratulations! You made it through the instructional portion of this video series. Now let’s see what you can do on your own. In this assignment, you’ll build a simplified version of our note taking application. IMPORTANT: before you peek at this video, please—for your own sake—try to complete this homework assignment on your own. You’ll only learn through practice, frustration, and exploration.
Got stuck with the homework assignment? No worries, simply watch enough of this solution video to get un-stuck, OR compare your solution with Bob’s version. IMPORTANT: before you peek at this video, please—for your own sake—try to complete this homework assignment on your own. You’ll only learn through practice, frustration, and exploration.
Today we’ll be building an entire application from start to finish. The project will be a Geo-Location note taking application. As a user creates a new note, the location of where the note was composed will be saved along with the note. The user will be able to add notes, as well as edit or delete them. In this video, Bob lays out the plan for the rest of the day, including a demonstration of the application that we’ll build, how we might design the application, and more.
In this first video for our Day 4 project, Bob creates a new project, adds files for the Add and EditDelete note pages, and sets some of the basic properties of each page.
Next up for our Day 4 application, we add the controls, set the properties for the MainPage.xaml, and discuss how the ListBox will work.
In this video, Bob discusses the strategy of using the file name as a means of storing the date and time the note was created, along with the location of the note’s composition. This requires quite a bit of familiarity with String and DateTime classes and their methods for formatting and parsing through data.
Now that we have and can create files with the naming convention, we want to retrieve the names of the files, parse their contents, and display them in a ListBox. In this video, Bob shows how to use the DataTemplate to display both the note’s location and date in the ListBox using a HyperlinkButton and a TextBlock.
Time to move on to the next part of our Geo Location Note taking application and provide the ability for the user to add a new note. In this video, Bob adds the code required to navigate to the Add page from the MainPage.xaml, and adds both the TextBox control and Input Scope for the note.
In this video Bob uses the Day 3 example to call the TerraService passing the coordinates from the phone’s GPS to the web service in order to retrieve the city, state, and country. These values are saved in a private member variable of the class, which can be used when the note is saved.
Now that we have all the parts we need, it’s time to construct the file name and save the file’s text. Then, we’ll navigate back to the MainPage.xaml and see the new note in the ListBox.
In this video, Bob sets up the controls required to both display and edit the note. He also adds the icons for the various features of this page, including back, edit, save, and delete buttons.
Bob wires up the navigation between the MainPage.xaml’s ListBox and the ViewEdit.xaml page. In the process, we learn about the Tag property of the HyperlinkButton to store the filename of each item in the DataTemplate. Using this, a QueryString can be constructed and used to pass the file name of the desired file to the ViewEdit.xaml page.
In this video Bob uses previously discussed techniques to switch back and forth between view and edit modes by copying the content from the TextBlock to the TextBox before setting the visibility of each control. Finally, the data changes are applied to the underlying file.
Delete functionality allows a user viewing a note to delete it and return back to the list of notes. This video shows both how we enable that feature and—as Bob demonstrated on Day 3—how to display a Canvas dialog to warn the user about deleting the note.
Using the Canvas dialog technique again, Bob adds a Help dialog to the MainPage.xaml. He uses both a Button control and an icon to enable the closing of the dialog, and adds a ScrollViewer to allow more text than can fit on the screen to be presented.
Now that the majority of the functionality is complete, Bob starts hardening the application by considering what happens on each of the three Silverlight pages when the user clicks the Back or Start buttons. Using the lessons learned from the Tombstoning and Task Switching discussion on Day 3, Bob decides how to handle this situation and starts down the path, detecting the user’s location before clicking the Start or Back buttons and restoring the user to that exact state when the application is next launched.
This video continues working through the Tombstoning and Task Switching scenario, enabling the scenario for the Add.xaml page.
This video continues working through the Tombstoning and Task Switching scenario, enabling the scenario for the ViewEdit.xaml page.
In the previous video, we were left with an error, requiring that we take the time to track down the problem and fix it. This video shows the thought process behind debugging the problem and how to find the its true source.
Nearing the end of development, Bob shows how he cleans up the code and combs through it to include better code comments. He also shows where to download the Windows Phone 7 Requirements PDF, and outlines the dos and don’ts for BEFORE you attempt to submit your application for inclusion in the market place. He also replaces the icons and creates other graphic resources required by this process.
In this final video, Bob shows you some of the resources that most helped him as he got started learning about the Windows Phone 7. Additionally, he provides a general road map for further exploration of the C# programming language, the .NET Framework, Silverlight, and more.