navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

Up and Running with Windows Phone 8 Development

Up and Running with Windows Phone 8 Development

with Doug Winnie

 


This course provides an introduction to the Windows Phone 8 platform and the basic tenets of the Modern UI design style, through the development of a basic tip calculator application. First, author Doug Winnie shows how to install and set up the Visual Studio tool to build your application. Next, learn how to use XAML to build a basic structure for your application's interface and customize its design with user- and system-defined styles and options. This user interface connects to application logic with a process called code-behind files, which are written in C#, one of the three languages available to build Windows Phone 8 applications. Finally, discover how to add icons and other design elements to your application and then submit it to Microsoft for inclusion in the Windows Store.
Topics include:
  • Installing Visual Studio for Windows Phone
  • Exploring the evolution of Windows Phone
  • Laying out interface components with the StackPanel
  • Adding buttons and text inputs
  • Changing fonts and colors
  • Building the application logic
  • Testing in the simulator
  • Adding design assets
  • Deploying to the Windows Store

show more

author
Doug Winnie
subject
Developer, Mobile Apps
software
Windows Phone 8, Visual Studio Express 2012
level
Beginner
duration
2h 4m
released
Apr 19, 2013

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:00(music playing)
00:03Greetings! I am Doug Winnie, and I'm going to take you through the basics of building apps
00:09for Microsoft's Windows Phone 8 platform.
00:11Windows Phone 8 is the latest generation of Microsoft's mobile platforms that
00:14has a unique design aesthetic that ties in with the latest version of their
00:17desktop operating system, Windows 8.
00:20Windows Phone 8 combines a number of unique features, like live tiles that give
00:24you updates to the things that are important to you, right on your home screen.
00:27In this course, we'll look at the overall process of making an app for Windows Phone 8.
00:32We'll start with an overview of the project, then we'll dive into creating
00:36the user interface using Visual Studio 2012 for Windows Phone and the XAML Markup Language.
00:43Next, we'll build the logic of our app using the programming language C#, and
00:47then look at the design templates that Microsoft provides to help us make icons
00:51and images for our app.
00:52Finally, we will test our app using the built-in emulator and on a locally-
00:57connected device, then submit the Windows Phone Store for people to install on their phones.
01:03So, let's get Up and Running with Windows Phone 8 Development.
Collapse this transcript
What you should know before watching this course
00:00This is a beginner course for building applications for Windows Phone 8.
00:04I don't make any assumptions that you know how to develop using previous
00:07versions of Windows Phone, Windows, or other .NET technologies.
00:11To build applications for Windows Phone 8, you need to have a Windows 8 computer.
00:14Due to the configuration of some of the tools that are a part of the developer
00:17toolkit, running Windows in a virtual machine may not work.
00:20It's recommended that you work with an operating system installed on native hardware.
00:24If you're on a Mac, you can use Boot Camp, but be aware that not all the Windows
00:288 drivers for Boot Camp are currently compatible with Boot Camp.
00:32This course assumes you've a working knowledge of the Windows Phone 8
00:35operating system, and have access to a Windows Phone 8 device to test your
00:38applications. Testing on a device isn't required to complete the course, but
00:42it is very helpful.
00:43It's also helpful if you've worked with the Code Editor or IDE (or Integrated
00:48Development Environment).
00:49This course will work with Visual Studio 2012, the main IDE for Building
00:53Windows Phone 8 Apps.
00:55Finally, it's helpful if you have some programming experience.
00:59This course uses C#, but if you have experience with Java, JavaScript, or other
01:03languages, it will help.
01:04I won't go into the details of the C# language in this course, but you will
01:08be writing some C# code, and I'll help you out along the way with any tricky sections.
01:13For a more in-depth look at C#, check out C# Essential Training, here in the
01:17Lynda.com Online Training Library.
Collapse this transcript
Using the exercise files
00:00With your course, there is a collection of exercise files you can use to follow
00:03along with the videos.
00:05These are available on the course landing page of the Lynda.com website.
00:08When you download the course files, they'll be an archive file that, when
00:12uncompressed, will contain folders for each of the videos.
00:15Each folder contains two versions: one called start, which is the project you need
00:19to open when you start the project, and then the end, which is the example of what the
00:23project should look like when you're finished.
00:25As you learn more about Windows phone development, and the technologies and
00:27languages that are part of it, I recommend using these finished examples to
00:31experiment with and add new features.
Collapse this transcript
1. Installing Visual Studio for Windows Phone
Downloading and installing Visual Studio Express
00:00To get started building Windows Phone applications, you need to install
00:03Visual Studio, the IDE (or Integrated Development Environment) that is provided by Microsoft.
00:09Visual Studio comes in many flavors, from free versions for individual users, to
00:13paid versions for large-scale projects and distributed development teams.
00:17For most projects, the free Express version of Visual Studio provides easy-to-use
00:21and powerful tools to make developing applications for Windows Phone easier.
00:25If you want to learn more about Visual Studio, check out Visual Studio Essential
00:28Training here in the Lynda.com Online Training Library, which goes into much
00:32more depth about the application.
00:34Again, the version we're going to work with is Visual Studio Express.
00:38There are multiple versions of Visual Studio Express for different projects.
00:41To get started, we need to go to MSDN or the Microsoft Developer Network website.
00:46You should bookmark this site, because it has a ton of useful information on
00:49Windows Phone Development.
00:50So to get started, head over to dev. windowsphone.com. From here, you can download
00:56the SDK (or Software Development Kit), which includes all the tools you'll need,
01:01including Visual Studio 2012 Express for Windows Phone. Click on the GET SDK
01:06link on the page to get started.
01:07There are multiple versions of the SDK available.
01:10We are going to work with Windows Phone 8, so you'll want the SDK 8.0 listed at
01:14the top. Click the download link to get started.
01:17You'll be prompted to download a small installer file.
01:20Click Run, and the application will download, and start in your system.
01:23The installer screen for the SDK will appear. To continue, you'll need to agree
01:27to the Terms and Conditions provided by Microsoft to use the software. And, click Install.
01:32When you do this, the installer will download the full SDK, which is about 1.6 GB in size.
01:37So, be sure you have the Internet connection on during the installation process.
01:41After the installation is complete, you will have the option to launch Visual
01:44Studio to get started.
01:45In Windows 8, an icon for Visual Studio 2012 and other tools will be placed on
01:50the far right of your Start screen.
01:52After the install is complete, you'll have the option to Launch Visual
01:55Studio and get started.
01:56If you're on Windows 7, you can launch Visual Studio Express for Windows Phone
02:00from the Start menu, under Windows Phone 8.0 SDK. Under Windows 8, an icon for
02:05Visual Studio 2012 will also appear in the Start screen on the right-hand side.
02:09Now that the tools are installed, we can now walk through how to create a new
02:13project, and take a look at some of the basics of the Visual Studio Interface.
Collapse this transcript
Creating a Windows Phone project
00:00To begin making a Windows Phone app, you need to create a project, or solution, as
00:04it is called in Visual Studio.
00:06A solution is a combination of multiple files, or even multiple projects, that
00:09are grouped together.
00:10In this case, we need to create a solution for Windows Phone project. To start,
00:14Launch Visual Studio. When you launch Visual Studio for the first time, it is
00:18going to ask for a product key. You can click on the Register online link to
00:22provide your email address and user information to get your key.
00:26Your key will be provided to you in an email.
00:28I am just going to paste my key here.
00:30When you have entered your key, click Next. When your Product key is
00:34applied, click Close.
00:36When Visual Studio starts up, you will be greeted with a welcome screen that
00:39gives you some helpful information and links.
00:41It also checks to see if there are any updates to the software,
00:44and will prompt you to download them.
00:46Updates to Visual Studio add new features, and also update some of the code that
00:50is automatically written for you in new projects.
00:52So, there might be some slight differences with your version than the that one I'm
00:55using for this course.
00:57But don't worry. These changes wont' affect what we're working on.
00:59Visual Studio has two modes in terms of the User Interface.
01:03By default, it starts with the light theme.
01:04I am going to change this to the dark theme, so that you can see things more
01:07clearly in the video.
01:10To do this, open the Tools menu, select Options, and then change Color theme,
01:14to Dark, and click OK.
01:17From here, you can click on New project on the left-hand side under Start to
01:20create a new project.
01:22You can also open up the File menu, and select New project from there. Whichever
01:25you use, you are presented with the same dialog box, the New Project window.
01:30From here, you can select which type of language you want to work with, and select
01:33a Starter Project to begin with.
01:35For our project, we are working with C#, so we need to select Visual C# from the
01:39Templates area on the left. From here, we can select Windows Phone.
01:43In the center column, we will want to create a Windows Phone App, so we
01:47can select it here.
01:48You'll notice the icon on the left of the Project description; there is a little
01:51green C# showing that this a C# project, plus the phrase Visual C# on the right.
01:58In the right column of the window, it shows a Preview of what the starter
02:01project will first look like. After we create it, we will add new items to it, and build our app.
02:06In the bottom section, you need to give your app a name, and define a location for
02:11on your local machine.
02:12When you update the name, click OK to build the project.
02:14I am just going to use the default name here, just to get us into the interface.
02:18The last thing you need to select is which version of Windows Phone you're
02:21building your app for.
02:22In this case, we're building it for Windows Phone 8, so select that, and click OK.
02:27With that, Visual Studio will churn away for a few seconds, and create
02:30your project. You are then greeted with your new project, and are ready to get started.
02:34In the next video, we'll look at the Visual Studio Interface, so you can get
02:38comfortable working with it before we start building our project.
Collapse this transcript
Exploring the Visual Studio interface
00:00At first, Visual Studio can seem a little daunting and complex, but it actually
00:04is quite intuitive when you get to learn how to use it.
00:07In this video, we will give you a quick tour of the interface and some of the
00:10panels you will be using in the course. Just like with any windowed application,
00:14there is a Menu bar at the top that holds most of the application's functions.
00:18Under there are shortcut buttons to access other features. Under those, there are
00:22four main sections of the interface.
00:24Let's start from the left, and work our way to the right.
00:26First, you'll see a panel called Device. This controls some of the visuals of the
00:31device Preview View to the right of the interface.
00:33Windows Phone has a number of resolutions it supports, and two major themes: dark and light.
00:39There are also Accent colors that can be used to customize the interface even further.
00:43This panel sets these options to give you multiple views to preview your app.
00:48The device preview window is actually much more than that. You can select and
00:51place new items, and manipulate the items directly within the window.
00:55To the right of that is the code -- in this case, XAML, -- that is creating the
00:59interface for the application.
01:01Currently, the text in here is rather small for you to view in the video, but we
01:04will be making this larger later on in the course.
01:07The preview area and the code are actually two halves of the single window, in
01:12this case showing the contents of the page, mainpage.xaml.
01:16You'll see in the middle of the two halves, there are some tabs that allow you to
01:20swap between the two.
01:22At the bottom, you can adjust how you want the items split, either horizontally
01:26or vertically, or collapse one of the panels.
01:33Finally, at the bottom, there are zoom options for both the Design view and the Code view.
01:42Let's move to the right side now. By default, this shows the Solution Explorer,
01:46which shows all the folders and files that are part of your project, or as
01:49Visual Studio calls it, your solution.
01:52As you can see, there are a few things that are already built out for you here.
01:56To see more, let's select the mainpage.xaml that is in the list.
02:00This is the one file that was already open on the left. When you have it selected,
02:05click on the wrench icon at the top of the panel.
02:08This opens the Property window, which is really helpful when you're working with
02:11items on the screen.
02:14Let's zoom back to fit the entire phone in the Design View, and see how selection
02:18in the Design View updates the Property panel on the right.
02:21With this open, click on one of the items in the Design View, like the Page name text.
02:26You'll see that the Properties panel displays dozens of properties for the item,
02:30like color, font, size, position, and others.
02:34This item, as you can see in the Properties panel, is called a TextBlock. On the
02:39left, there are two other panels that can show more of the different types of
02:42items we use in our project.
02:44Click in the Toolbox on the left-hand side. This a docked panel that auto hides
02:49when it is used. It displays all the types of components and items you can
02:53display in your project.
02:55This includes items that are part of the Windows Phone 8.0 SDK, as well as
03:00others you can add in from third parties.
03:02Next, click on the Document Outline docked panel. This panel shows the items and
03:06components that are currently in the file you have open.
03:09As you can see, the page name item that we have selected is selected already in
03:13the document outline, and is part of a number of other objects.
03:16This view also shows what objects are inside other objects. It can help
03:21when you're navigating complex arrangements of objects and components in your project.
03:25As you can see, we start with the PhoneApplicationPage. And then, within that, we
03:29have a grid called LayoutRoot.
03:32If you select these items, you can see them selected in the Design View, and the
03:36code view will jump to that section of the code as well, making navigation
03:39between components easier.
03:43Let's jump into a C# file, and see how the interface changes a bit.
03:47On the right side, in the Solution Explorer, expand the mainpage.xaml file, and
03:52you'll see mainpage.xaml.cs. This is a C# file called a code behind file.
03:58We will explain a bit more about what each of these files mean in the next
04:02section, but for now we will take a look at it in Visual Studio.
04:04As you can see, the interface changes with the code taking over most of the
04:07screen. Since we are working with C#, and not with the visual items that are defined
04:12in xaml, the device preview isn't part of this layout.
04:15We can switch back to the XAML file by clicking on the File tab at the top
04:18of the screen.
04:20So, that's our quick tour of Visual Studio.
04:22In the next section, we will take a longer look at Windows Phone itself, and the
04:26various technologies that are part of it.
Collapse this transcript
2. Windows Phone 8 at a Glance
Evolution of the Windows Phone
00:00Windows Phone first came on the scene at Mobile World Congress back in February
00:04of 2010. Its unique graphic design aesthetic and topography-heavy style were
00:09big departures from others in the marketplace, including Apple, Google and Blackberry.
00:13The other big difference was the strict hardware requirements that Microsoft
00:16placed on handset makers.
00:18Windows Phone 7, the first version of the platform, supported only one resolution
00:22and a single set of hardware requirements.
00:24There were a very few options that hardware manufactures could put into the
00:28phones, especially compared to Android. But part of this was to have a
00:31consistent interface and form factor to build for, which has plagued Android
00:35with varying screen sizes, interface modifications, and device-specific hardware or augmentations.
00:40With Windows Phone 8, Microsoft took the design language of Window Phone 7, and
00:44gave it an update. Along with it, a number of key hardware restrictions were
00:47removed, and the platform embraced more modern hardware, varying screen sizes, and
00:52technologies like near field communication.
00:54Under the hood, Windows Phone 8 is based on the Windows NT Kernel, instead of
00:58Windows CE, which Windows Phone 7 was based on.
01:01As a result, there are a number of technologies that are crossovers between
01:04Windows 8 and Windows Phone 8, making it easier to put applications between the two
01:08platforms. But let's focus on the design of the platform for a second.
01:12There are five basic principles that Microsoft has adopted for Windows Phone 8 --
01:16and Windows 8 for that matter, --
01:17that you should become familiar with to help build consistency across the
01:21various apps on the platform.
01:22The first principle is pride in craftsmanship.
01:25When you are creating your application, pay attention to the small things in
01:28your design. Apps that are part of smart phones are accessed frequently and
01:32often, and having an extra set of polish will make each experience with it
01:36much more enjoyable.
01:37There is guidance to follow a design grid to help to keep things organized, and
01:41to provide visual hierarchy and balance to your application.
01:44There is also emphasis to find topography that reflects your apps'
01:47personality and purpose.
01:49It helps to set the tone for what people will do in your app.
01:52The second principle is to do more with less.
01:54If you are focusing on the content, you can create a clean and purposeful
01:58experience with little on the screen.
02:00This extends to the interface as well as the content, as you will find very
02:04little crumb in Windows Phones apps, and in the operating system in general.
02:07Next, Windows Phone apps should be fast and fluid.
02:10This is done through motion, which is a key part of the platform, and through
02:13the use of tiles that are alive and full of information that is relevant to the
02:16user, and gives them a view into what is going on within an app or process
02:21before going into it.
02:22This is a big design principle that has crossed over between Windows Phone
02:26and Windows 8. And, you can see it throughout the Windows Phone and Window Start screens.
02:29The next principle is probably the biggest visual distinction between
02:32Windows Phone and others.
02:33The desire to be authentically digital. This is to embrace the fact that
02:37you're working within a digital environment, and to base your interface and
02:40designs within that.
02:42Microsoft makes the distinction between Infographic and Iconographic, pitting
02:46its own design aesthetics from Windows 7 and earlier against their new style.
02:51On the other end of this is iOS, which uses a style called Skeuomorphism, which
02:55attempts to replicate items, textures, and objects from the physical world in the digital world.
03:00Microsoft's design style is very much the opposite of this, and they encourage
03:04you to bring that your application.
03:06Finally, the last item is win as one, meaning, as you take your application
03:10across different devices, form factors, and users to use a common UI model, so that
03:14your users will be able to take what they learn from one platform, and
03:17immediately be able to use it on another, without needing to reinvent the wheel.
03:21With an understanding of Windows Phone has come to where it is today, and with
03:25the understanding of its unique design style, let's next look at what goes on
03:28under the hood, and the technologies that are the part of the platform.
Collapse this transcript
Technologies and languages of the Windows Phone
00:00Windows Phone supports a number of technologies and languages to build your applications.
00:05There are generally two types of apps you can make for Windows Phone.
00:08The first are applications that are built using Windows User Interface
00:11components. These are from the .NET Framework, and you typically build the layout
00:15for your application using a language called XAML.
00:17XAML is a tag-based language similar to HTML, where you create the layout or
00:22view of your application.
00:24Each of the tags in XAML map to a component, element, or a class in the language.
00:29To get these various components to work and interact with data in the user
00:32interaction, you need to create logic in your code, which is done with a code
00:36behind file that is linked to the XAML file.
00:39This pair is pretty consistent when you're building apps for Windows Phone, and
00:42can be done with a number of languages, including C#, which we are going to use
00:46in this course. You can also use Visual Basic.
00:49The other type of app is a DirectX application that is typically used to create
00:533D games. Because of hardware and kernel updates between Windows Phone 7 and 8,
00:58you can now create DirectX games that work with native hardware.
01:01These apps are made using C++.
01:03You may also have noticed the phrase XNA appear with the Visual Studio if you have
01:08been poking around.
01:09XNA is an older game development framework that was used to create games for
01:12Windows Phone 7. It is maintained in the 8.0 SDK for consistency, but Microsoft's
01:18guidance is to migrate to DirectX in C++ for game development in the future.
01:22In addition to these first-party development technologies, there are a number
01:25of third-party and cross-platform frameworks you can use to build apps for Windows Phone 8.
01:30Some of these include PhoneGap and Unity.
01:32PhoneGap uses HTML and JavaScript to build applications.
01:35PhoneGap Build, a cloud-based compilation service, supports Windows Phone 8 projects.
01:41Unity, a popular game development platform, has announced plans to support
01:44Windows Phone 8 as well, allowing people to port games from iOS, Android, Xbox
01:49360, PS3, and Wii U to Windows Phone as well.
01:53So, as you can see, there are a lot of technologies that are available for you to
01:56use with Windows Phone 8.
01:58For this project we will use C# and XAML to build our app.
02:01In the next section, we'll cover in- depth what we are going to make, and how it
02:05will be made, and the steps involved. Then it's off to coding.
Collapse this transcript
3. Project Overview: "Tipd"
What we are going to make
00:00The project we're going to make in this course is called TIPD,
00:03a calculator you can use to determine the right tip, or gratuity, for a bill at a restaurant.
00:07The application will allow the user enter a numerical amount to calculate.
00:11If the value entered isn't valid, it will notify you using color coding.
00:15Next, the user selects a TIPD language, and the app then shows the TIPD amount,
00:19and then adds the amount to the original bill to give you the grand total for the bill.
00:23The interface features a background image that will scale to fit the screen,
00:27and also uses colors that are based on the user-defined theme for their specific phone. [00:00:3.79] While the application itself is pretty basic,
00:33it'll provide a good starting point for you to become familiar with some of
00:36the ins and outs of Windows Phones 8 to help you build your own applications when we are done.
00:41So, let's jump into some more details on how the app is going to be made.
Collapse this transcript
How we are going to make it
00:00Our app is going to use components that are part of the Windows Phone 8 SDK. And,
00:04we can work with these components to attach logic and functionality using C#.
00:09First, we have the layout of our app, which is created using XAML.
00:12The top app name and page header are part of the built-in app template that we
00:16just customize with our own text.
00:18The background image is called an image brush that we will add to our app
00:22background, and point to a bitmap that we'll import into our project.
00:26Next, we have a number of text blocks that will serve as our labels for the
00:30various fields and sections of the interface.
00:32The amount of the bill is entered into a text box, which we can constrain to certain
00:36types, which change the layout and options of the on-screen keyboard.
00:39The user then taps one of the five buttons to determine the tip amount they want
00:43to provide to their server.
00:45These are basic buttons that we will attach specific functionality to. When
00:48someone selects these, we'll display the calculated tip and the grand total of
00:52the bill using additional text blocks.
00:54But we'll use a formatter to display these using dollars and cents.
00:58Behind the scenes, the logic we'll create in C# will take the value the user
01:02enters in, and convert it to a number, since in a text box, it is considered as
01:06letters and numbers, or a string.
01:08We'll then work with the few variables in the project to calculate the tip, and
01:11then convert them back into text to display in the text boxes.
01:14While that covers the basics of what we're going to make, there are other
01:18steps that are involved in creating an app, and we'll talk about those in the
01:21next video.
Collapse this transcript
Steps covered in this course
00:00Making an app for Windows Phone isn't just coding. There are a number of other
00:04steps that you need to consider when you're building your app.
00:07First, we need to create an account with Microsoft to submit the app to the
00:09Windows Phone Store. When we have that,
00:12we can then start building on our profile to start selling apps in the store, and
00:16to get paid for them.
00:17When we build the app, we'll want to test our app within the button simulator
00:20that comes with Visual Studio.
00:22But we will at some point need to test on an actual device. And, we need to
00:27provision that device as a developer device for Visual Studio to recognize it.
00:30After we build the app, we need to rev up the creative side of our brain, and create
00:34an app icon, and other screen shots to display in the Windows Phone Store on the
00:38device, companion app for Windows 8, and on the Windows Phone website.
00:43We'll take a look at the design templates that Microsoft offers to help you
00:46create icons and designs that fit within the overall aesthetic of the platform.
00:50When we have these assets, we need to import them into our project, and define
00:53the capabilities of the app.
00:55This is done by defining the app manifest.
00:58With that done, we can do a final test with the release version of our app. And, if
01:02everything looks good, we can take that final build called a XAP, and upload it
01:06to the Windows Phone developer dashboard, and submit for review.
01:10After several days, if everything looks good, you'll get an email that the app is
01:13launched, and we can now see it in the store available for purchase.
01:17So, now that we know everything about what we are making, how we're making it, and
01:20the steps that go into making it, let's start building, and actually make it.
Collapse this transcript
4. Building the Interface
Customizing the default application layout
00:00To get started, we are going to create a new project, and update some of the
00:03built-in components to reflect the name of our app.
00:06When we're done, we'll have the name of our app and the description of what
00:09people will do on the screen.
00:11There's no project to start from in the Exercise Files, so let's create one
00:14from scratch, ourselves.
00:16First, launch Visual Studio, and create a New Windows Phone 8 project.
00:20Remember. To do this, make sure you have Visual C# and Windows Phone App selected.
00:25Let's name our app "TIPD," and use the default location for the app, which would be
00:29used in your user account documents folder, under the subfolder Visual Studio 2012
00:34and Projects. Click OK and create the project, and then select Windows Phone 8.0
00:39as your SDK you wish to use for your app, and click OK again. With that, you'll
00:43have a default Windows 8 App ready to go.
00:46Let's take a look at what we have here already.
00:48I've modified the layout of the panel slightly, to help you see things more
00:51clearly in the video.
00:53If you need a refresher on the overall interface of Visual Studio, check out the
00:56third video in Chapter1 for more information.
00:58I am going to make this a little bit smaller, so we can focus a little bit more on the code.
01:03If you look at the Designs view on the left, you'll see that the app has a few
01:06items already created.
01:08First, there is some text that says MY APPLICATION.
01:11Traditionally, this is used to display the name of your application.
01:14In this case, it would say TIPD. Below that are the words "page name." This is the
01:20page or the section of your app that will contain information, functionality, or
01:23interactions that are grouped for a specific purpose.
01:26You notice that MY APPLICATION is in all caps, and page name is in all lowercase.
01:31This is traditional for the Windows Phone 8 design language. And, while you can
01:34change it and do your own thing, I prefer to maintain consistency with the rest of
01:38the operating system, since that is what your users will be used to.
01:41Click on the MY APPLICATION text at the top of the phone in Design view.
01:45You'll see that the text is highlighted, and the curve view will shift to show
01:49the code related to the object you selected.
01:51If you look at the code, there are two main sections of code.
01:54The first is called the TitlePanel, which starts on line 42. This area of the app
01:59contains the two text fields, or to be more accurate, TextBlock components, which
02:02are on lines 44 and 45.
02:05You'll see that these are wrapped by a common component called a StackPanel.
02:09The opening tag is on line 43, and the closing tag is on line 46.
02:13We'll work more with the StackPanel in the next video, but essentially it allows
02:17you to layout components in a stack, either horizontally or vertically, as it is
02:21doing here, which is the default layout for the StackPanel.
02:24On line 48 is the other section of our project, the ContentPanel.
02:28The interactive components of our app will be placed here.
02:31We will do those in the next video, so hold off on that section for right now.
02:35To change the text for the items that are already on the page, we can select and
02:38enter them in Design view, or we can edit their tag attributes in Code view.
02:42While working with text in Design view is easier, I found that it ultimately
02:46is faster to edit them directly in Code view.
02:49In addition, you'll get to learn more about the various tag types and become
02:52more comfortable with XAML language.
02:54So, let's change the app Name first. Go to line 44. You'll see the opening
02:58TextBlock tag definition. After the opening, there is an attribute called Text.
03:03The value within the quotes is what we want to change to customize the name.
03:07So, enter TIPD in all caps within the quotation marks after Text. After you
03:14enter the text, the Design view may not update immediately. Just click the
03:17Design view window, and it should update for you. Great!
03:20Step 1 is done.
03:21Now we can repeat the same process for the second TextBlock component on line
03:2545. This time we want to change the text to read "calculate," since that is what
03:30will happen on this page of the app.
03:32Again, change the value "page name" to "calculate." Great!
03:37With these built-in components updated, the next step is to start building the
03:40new components we will need in our app.
03:42We'll do that in the next video.
Collapse this transcript
Laying out components using the StackPanel
00:00In the last video, we worked with the components that are pre-built in our new
00:03Windows Phone App project.
00:05In this video, we're going to create our own, and arrange them in what is known as a StackPanel.
00:10At the end of this video, you'll have a project that'll have some new user
00:13interface components laid out.
00:14We'll use a combination of component types to build the controls in the next few
00:18videos. And, although they won't work, our app will start to look closer and
00:21closer to the finished project with each step.
00:24Along the way, you'll get introduced to new component types. And, we'll give each
00:27of our components a unique name that will allow us to work with them when we
00:30build the logic behind the app layout in C# in the next chapter.
00:34So, let's get started!
00:35If you're running through the course in order, you can stick with the project
00:39from the end of the last video.
00:40If you're starting fresh, you can access the starter version of this project
00:43with the course Exercise Files.
00:45Open the solution file, and you'll be at the same point that I'm at.
00:49Okay, the first thing we need to do is create our StackPanel that will be used
00:51to contain and lay out our components.
00:54In XAML, there are generally two basic types of components. There are components
00:58that do things and there are components that organize and lay out other components.
01:02The StackPanel is one of the second type. As we saw in the last video,
01:06the StackPanel is used to stack components vertically or horizontally.
01:10We need to do this in the ContentPanel section of our app, which was after the TitlePanel.
01:14If you look at Visual Studio, you'll see that the ContentPanel code starts at
01:18line 48. It starts with some descriptive text, and then there is a component
01:22called a Grid on line 49.
01:24A Grid is another type of layout component. The Grid component is a bit
01:28advanced, and we aren't going to cover it in this course.
01:30So for now, let's just leave it be.
01:33Just like with the previous video, you can add components using the Design view,
01:35but it's important to understand the code, so you can better work with it, and modify it later.
01:40So to start, we're going to create a new StackPanel component.
01:43On line 50, in between the opening and closing Grid tags, write the following code.
01:47We're going to start with the less than symbol, and start typing in StackPanel.
01:51As you can see, Visual Studio shows us a list that matches the words
01:54we've already entered in.
01:56When StackPanel is already highlighted, I can press Tab, and that'll complete the
01:59sentence for me. I'm going to then close this tag with a greater than symbol. And,
02:04you'll see that the end tag was already created for me automatically.
02:08I'm going to create a little bit of space here, because I'm going to be adding
02:12in code inside these two texts.
02:14The default layout for a StackPanel is vertical, which is what we want for this layout.
02:18So, we don't need to add anything else to these tags.
02:21Now we can start to add in the individual components within our StackPanel.
02:25So, in between the two StackPanel tags -- on my screen it's currently on line 51, -- we
02:31can start adding in some of the components.
02:33The first is a TextBlock, which is the same component we modified in the last video.
02:37To create a TextBlock, we're going to use the same process we used for the
02:40StackPanel. Start with the less than symbol, then start typing in TextBlock.
02:45Again, the code completion already shows that that's highlighted, so we can
02:48press Tab, and that will complete that for us.
02:50Now, remember XAML is an XML-based language,
02:53so you can use an opening and closing tags. Or in this case, we can use a self-closing tag.
02:59It's a good idea to give our components a unique name.
03:02That way, if we ever need to change a value or attribute of the code later.
03:06we have a name we can use to reference it.
03:08In XAML, you can use the X:Name attribute to give it a unique name.
03:13If you're familiar with XML languages, you'll see that this is a name-spaced
03:17attribute. The X namespace is defined at the top of the project.
03:21Let's go ahead and give TextBlock a unique name now.
03:23I'm going to go right after our TextBlock statement here, and then type in
03:26x:Name. Let's tab to enter that in.
03:30Now, this may be review for some, but just in case, unique names, or instance
03:34names, don't have any special characters or spaces. An exception here is the
03:38underscore, which you'll see later in the course.
03:41There are also various capitalization best practices across languages.
03:44I tend to use the Pascal case in C# for component names.
03:48That means that the first letter is capitalized, and other names that are
03:50concatenated with the first are capitalized as well.
03:53So, in this case, I'm going to call this AmountLabel.
03:57Now that we have the basic tag, we can add attributes to customize it.
04:00We need to create the Text attribute, and add the text to display in the component.
04:05To do this I'm going to go after our x:Name tag, and then type in Text. Now,
04:09inside of this, I want to start putting in the text that I want to put into this
04:13particular component.
04:14So, to match the users of design style of Windows Phone, I'm actually going to
04:18put this in all caps: AMOUNT OF SERVICE OR BILL.
04:23Let's repeat this again for the second label, which we'll call Tip Label.
04:27I'm going to go to the end of the line, create a new line, and then start by
04:31creating a new TextBlock. Use x:Name to give it a unique name. Again, we'll
04:36call it TipLable, and then we will enter in some Text. In this case, I'm going to
04:41say TIP PERCENTAGE.
04:44Now, if you look on to the left, you will see the Design view is starting to
04:46stack these up on top of each other.
04:49That's why we're using a StackPanel, because we want to stack these on top of
04:52each other in the layout of our application.
04:54All right. With that done, let's go ahead and create two more to finish out
04:57what we have to do.
04:58I am going to create new TextBlock, again. x:Name. This one we'll call
05:03TipHeader, and then we'll enter in some text.
05:07In this case, what we'll say is TIP AMOUNT. Close our tag. And, we'll do
05:12this one more time. TextBlock x:Name. This one was called TotalHeader. Text TOTAL AMOUNT.
05:23When you are done, you should have all the header tags in place, and the Design
05:26view should be like mine.
05:28So, as you can see, the StackPanel handles all the layout of our components for us.
05:32With the headers in place within the ContentPanel section of our code, we can
05:35now start placing interactive components.
05:38In the next video, we'll add a Text box component into the first section of
05:41our layout.
Collapse this transcript
Adding text input and constraining input type
00:00A mobile app is pretty boring if it isn't accepting any input from the user.
00:04User interaction is handled often by interface components that are designed to
00:07get information from the user to change how the app works or functions.
00:11Since this is a tip calculator app, we will clearly need to have the user enter
00:15in the amount of the bill.
00:17In this video, we'll do exactly that, but we are going to add a twist to it.
00:20At the end of the video, you will have a TextBox component that will allow the
00:24user to enter in the amount of the bill or service.
00:27We will also modify it so the user will be constrained to enter in only numbers
00:31into the TextBox. This works in this case, because we're dealing with a price,
00:35which is always a number.
00:36So, let's get started.
00:37If you're continuing from the last video, you can work with the project that
00:40you already have open.
00:42If not, open the Start project for this video in the Exercise Files.
00:45Since we are working with a stack panel to organize our components, we will want
00:49to add our text input after the header text.
00:52In this case, we want to place it after the AmountLabel TextBlock, which on my
00:55screen is on line 51.
00:57The component we're going to use is called a TextBox. Unlike TextBlock, TextBox
01:03allows the value to be changed by the user.
01:06It is similar to a text field that you see on a webpage.
01:08You may get the two mixed up from time to time. I keep them sorted out in my
01:12mind if I remember that there is a box around any text that the user can change.
01:16Pretty simple, but it helps me keep things from getting mixed up.
01:19So, let's create a basic empty tag to get started.
01:22So, we will create a new line. And, we are going to create a TextBox. Press tab.
01:27With the basic tag entered, you'll see the Design view updated to show our new
01:30TextBox within our other component.
01:32Now let's give it a unique name. Just like before, we'll use the x:Name attribute
01:36to give it an instance name. x: Name. And let's call it "Amount."
01:42That's generally the basis of getting your TextBox in your app.
01:45Let's try it out in the simulator, and see how it works.
01:48To run the app in the simulator, click the green Play button at the top.
01:52There are various simulator types, but we will get more into some of the
01:55details of these in the later video.
01:57Also, the simulator can take a minute or two to get started when you launch it
02:00for the first time, so you may want to pause the video while it launches if
02:03you're following along.
02:04With that, I am going to launch the simulator to run the app.
02:07You may find the simulator app launches behind Visual Studio. Also, you see that
02:12the layout in Visual Studio will also change. This is because it's now in a
02:15debugging mode. It will return to our code editing mode when we actually end the simulator.
02:22Now the simulator will launch the operating system, and then install and run our
02:24app on the simulated device.
02:25So, now you can click within the device window to control it.
02:28If we click inside the textbox, you'll see that now that we have the soft keyboard
02:33that shows up at the bottom of the simulator window.
02:35Now, since this is going to be a number, we want to prevent users from having the
02:38ability to enter text.
02:40Let's go ahead and do that next.
02:41So, let's go back to our code in Visual Studio.
02:44To stop the debugging, I am going to click the Stop button at the top; it's
02:47a little red square.
02:49That will take us back into our Code view here.
02:51When you click the Stop button, it will disconnect Visual Studio from the
02:54emulator, but it will keep running.
02:56When you test again, which we'll do later, it'll pick up from where it left off,
02:59and reinstall, and relaunch the app.
03:01So, now we are back in the Visual Studio, and now we can go back into our TextBox
03:05component. And add an attribute that will change the type of input the user can
03:09enter into the field.
03:11This is done using the InputScope attribute.
03:14Let's go ahead and add it, and we will set to only accept a number.
03:17So, after my x:Name here, I'm going to enter in InputScope.
03:22Inside of the attribute value, let's go ahead and put a number.
03:25Okay. So, let's go ahead and test this in the simulator again, and see if this
03:28changes everything.
03:30Let's go ahead and click on the TextBox again.
03:32Now, you'll see only numbers and a decimal point are available.
03:36With this, we have made the app much easier to use, and can eliminate a number of
03:40possible errors that could have occurred.
03:41So, to look back in this video, we added a new type of component, the TextBox,
03:46which allows a user to enter in a value into an app.
03:48To test out the component, we also use the simulator to install and launch the
03:51app in a virtual device, and finally, we also adjusted the scope of the text box
03:56to change the keyboard that is displayed; in this case, to force the user to
03:59enter in only a number.
Collapse this transcript
Adding buttons and a horizontal StackPanel layout
00:00We already have the first part for how we need this application to work.
00:03The user is able to enter in the amount of service or bill, using the text box.
00:08The second piece information we need is the percentage that the user wants to
00:11use to calculate the tip or gratuity.
00:13In this video, we'll accomplish this by creating a number of buttons using
00:16the button component.
00:17We'll lay these buttons out horizontally using a new StackPanel component, and
00:21adjust its layout definition.
00:22For each button, we'll add a unique instance name, and customize the label for each one.
00:27If you're continuing off of the previous video, you're good to go; just keep
00:30working with project you've opened. If not, open the start project for this
00:34lesson from the Exercise Files.
00:36Let's start with the layout that we want use for the buttons.
00:38We've worked with the StackPanel before, but that was always working vertically.
00:42This time, we want to use the horizontal orientation.
00:45First, let's create an empty tag under the header text.
00:48On my screen, we would add a new line under line number 53.
00:51We'll go ahead and add in a new StackPanel, and it automatically creates our
00:55closing tag for that.
00:57And with the tags in place, we then want to customize the layout.
01:00To change this, we need to add the Orientation attribute to the StackPanel.
01:04So, I'll go up to StackPanel, add in Orientation, and we'll set this to Horizontal.
01:09Now when we add components between the tags, they will go from left to right,
01:14instead of from top to bottom.
01:15With the layout component set, we can now add the buttons.
01:18To do this, we need to create a new button component.
01:20Let's create an empty one to get started.
01:23So, I'm going to position myself between the StackPanel opening and closing tags,
01:26and then we'll put in Button. We'll use a self-closing tag for this one.
01:31If you look at the Design view, you'll see there is a small, white box under the
01:35TIP PERCENTAGE header.
01:36It is empty right now, because we haven't added any content to it. But before we
01:40do that, let's give it a name.
01:41Just like before, we'll use the x: Name attribute to name the component.
01:45Let's call it Percent5. Add in x:Name Percent5.
01:51With the name set, now let's add some content into the button. Unlike the
01:54TextBlock component, instead of using the Text attribute, we'll use Content.
01:59So, let's add the content attribute, and add a label for our button. We'll add in
02:03Content, and we'll make a label 5, and then the % symbol.
02:07After you enter the text into the Content attribute, you'll see the button
02:10update in the Design view. Great!
02:12Now that we have our first Button, let's add another, and see how they stack
02:15from left to right.
02:16Let's name this button Percent10, and enter 10% as the button content.
02:21With that created, you'll see again in the Design view that the components are
02:24indeed stacking from left to right along the horizontal axis.
02:29So, let's do this now for the rest of the buttons.
02:31We'll need to create one for 15%, 20% and 25%, each with a corresponding
02:35instance name and content text.
02:38Now we have all of the user input we need in our app laid out.
02:42So, let's go back and see what we did.
02:44First, we created a new StackPanel layout component, but instead of working with
02:47the default Vertical layout, we changed the Orientation attribute, so we set it
02:51Horizontal. So, now the contents stack from left to right.
02:55Within the StackPanel, we added the five button components.
02:57We gave each button a unique instance name using x:Name, and then added Text
03:02into the Buttons using the context attribute.
Collapse this transcript
Changing fonts
00:00With the user input controls finished, we can now turn to displaying
00:03information back to the user.
00:05To do this, we are going to add some additional TextBlocks to our layout, but we
00:08want to modify them slightly to make the app easier to use and read.
00:12Customizing fonts in Windows Phone 8 has a few caveats to it.
00:15While it is as simple as entering a text size and font family, there are some
00:19built-in resources to help ensure future compatibility, and keep your app looking
00:22consistent with the rest of the operating system.
00:25In this video, we will look at some of these options for creating
00:28consistent text in your app.
00:29If you are continuing from the previous video, you can keep working with the
00:32project currently open.
00:33If not, open the start project for this lesson from the Exercise Files.
00:37Let's start with the basics. Let's go ahead and go back into Visual Studio, and we
00:40are going to create an empty tag.
00:42We want to place this under the tip amount header text, which in my window, is on line 61.
00:47So, let's go ahead and start by adding in a new text block.
00:50Now, let's give it a unique name. We'll go back and say x:Name, and we'll call it TipAmount.
00:57Now, although the value of this TextBlock will be determined by code, which we'll
01:00be writing in the next chapter using C#, we should put some placeholder text in
01:04for now to see it in context with the rest of the layout.
01:06So, let's go ahead and add in a text attribute, and add in $5.25.
01:12Now we will see the text displayed on the left-hand side in Design view.
01:16But as you can see, it's not very easy to read.
01:17We need to adjust it to make it stand out a bit more.
01:20We can do this by adjusting the font size.
01:22For this part, we are going to work with the Properties panel in Visual Studio.
01:25Depending on your layout, it might not be open.
01:28To open it, click once on the file we were working with in the Solution Explorer,
01:32and then click the Wrench icon. That will display the Properties panel.
01:36In this case, I also have it docked here on the right-hand side.
01:39If you forget to click on a File in the Solution Explorer, you might get
01:42properties for the project or even for a different file.
01:45So, make sure you've clicked on the right one.
01:48The Properties panel is contextually sensitive to the objects selected in Design
01:50view, or the code that the cursor is currently on in Code view.
01:54To display the properties of our new TextBox, we are going to select it in Design View.
01:58You will see the name and type at the top of the Properties panel, confirming
02:02that we have the right object selected.
02:04We want to work with the Font properties of the TextBlock, which are under the heading, Text.
02:08We are going to click on the disclosure triangle to show all the different options.
02:12You will see that the current font size is 20 pixels. We can adjust this here to make it larger.
02:17Let's go ahead and set it to 48.
02:19You will see the text get larger in Design View, but I also want to call
02:22your attention to the Code view. A new attribute font size was added to the text block.
02:27If we go into the code, we can also adjust it here.
02:30Let's change 48 to 72. There. Now the text is nice and big. In fact, it is the
02:36same size as the calculate text at the top, which creates a nice symmetry with
02:39the layout, but the font is pretty bold.
02:42We can lighten the weight of the font by using a font family.
02:44In Windows Phone 8, the default font is known as Segoe WP.
02:49This font is installed on your system along with Visual Studio.
02:52Now, along with this font, there are a number of built-in styles, called
02:55System Resources, that you can use to apply to various components, including
02:59our new TextBox here.
03:01Accessing, though, is little tricky. But let's go through that together.
03:04First, make sure that the text block is selected.
03:07In the Properties panel, we want to click the little square to the right of the
03:10Segoe WP font family drop-down. You will see a little fly-out menu display.
03:15Select System Resource, and you'll see that there are a number of font styles that are
03:19built in. They range from Bold, Light, Normal, Semi-bold, to Semi-light.
03:24Select PhoneFontFamilySemiLight. It is slight, but the text is a little lighter in
03:29weight than it was before.
03:31As you can see, the font family attribute was added, but instead of a specific
03:35name, it is using the static resource to link the value of the attribute to its
03:39stored value that is part of the phone.
03:41Now, you may ask yourself, "This seems silly. Just pick the Semi Light font in the
03:44drop-down and call it a day."
03:46However, the power here is that if the default font changes for some reason, your
03:50app is future-proofed, since it isn't dependent on a specific resource.
03:54In the next chapter, we are going to use the same principle with color, and you
03:58will see that these styles can also be dynamic at times, which allows your app to
04:01customize itself based on user color and theme preferences.
04:04Let's repeat this for the second text block we need to create at the bottom. But
04:08this time, we'll do it in code.
04:10Let's call the text block TotalAmounts, and we will add in $25 as the placeholder.
04:14So, we are going to go Underneath TotalHeader, and create a new text block here.
04:18x:Name. And, we will call it TotalAmount Text.
04:24And we will add in $25.
04:26Now, we want to add in the other two attributes, font size and font family, here as
04:30well. So, we can go ahead and type in FontSize. We will make it 72. And then,
04:35FontFamily. We are going to enter it in exactly as we have it on line 62.
04:40StaticResource PhoneFontFamilySemiLight.
04:48Make sure you checked with how I have it spelled, also on line 62. There's a
04:51mixture of capitals and lower case letters, and it has to be exactly spelled the
04:55way that I have it here.
04:56Well, I'll just go to the end, and we'll close the tag.
04:58With this added, we now have our new TextBlock, and applied the font size and font
05:03family, just like we did before, but in this case we did it entirely in code.
05:06All right, so we covered a few things in this video. So, let's go ahead and take a look back.
05:10First, we created new text block components, and gave them unique names amd
05:13place holder values. [00:05:1.50] Then, we customized them using two workflows.
05:17The first was to open the Properties panel, and update it there. One adjustment was
05:21made to the font size, and the other was to the font family.
05:24But for the font family, we worked with the built-in styles or static resources
05:28for Windows Phone to derive the font from those predefined settings.
05:31The other workflow we used was entirely code-based, where we used the font
05:35size and font family attributes, and set them to the same values to get the
05:39same result.
Collapse this transcript
Changing colors
00:00Along with fonts, colors are popular ways to change the look and feel of your application.
00:04Working with colors in Windows Phone 8 isn't as straightforward as you might
00:08expect, but the color options make it possible to adjust dynamically to user
00:11preferences and themes.
00:13In this video, we will create a background behind our large text block components,
00:17and paint them with color in a few ways.
00:19First, using colors of your choice. And then, we can tap into the theme colors
00:23selected by the user, and paint using the color to maintain consistency with the
00:27user's personalization.
00:29As with previous videos in this chapter,
00:30if you're coming to this right after the previous video, you can work with the
00:33project that is currently open.
00:35If not, just open up the start project for this lesson from your
00:38downloaded Exercise Files.
00:40So, let's start with the bad news.
00:41TextBlocks do not have the ability to have background colors. You can change the
00:46foreground color, but you can't change the background.
00:48To create a background color, you need to create a container component, and give
00:52it a color value, then place the TextBlock component within it to get the same result.
00:56Let's stick with what we know, and work with a StackPanel component.
01:00The StackPanel component supports the background attribute, which we can set to a specific color.
01:04Let's get started and add one.
01:06For this, we need to add the StackPanel after the TipHeader.
01:10I just clicked the TipAmount field in the Design view, and that takes me right to
01:13the line of code in Code view.
01:15To create our StackPanel, we need to create it after this line of text on line 61.
01:20So, let's create a new line here, and then create a new StackPanel.
01:23I am going to give it a unique name, and we will call it TipPanel, and then
01:28we will close the tag.
01:30With the basic code here, we can now move the TipAmount TextBlock, and place it
01:34within the TipPanel StackPanel.
01:35So, I am going to take this line of code that we have here on line 65. I am going
01:40to cut, go over here, and then paste.
01:44Now we want to change the background color.
01:46So, we can do this, first, with the Properties panel.
01:48So, I am going to select TipPanel, and then open up our Properties panel. To access
01:53the colors, open up the Brush section.
01:56And if you look, by default, a StackPanel has no background, or in XAML terms, no
02:00color brush, used to paint the background of the object.
02:03We could adjust this by selecting the solid color option in the panel.
02:07Now you can adjust any of the values here, including red, green, blue, and alpha
02:11values, or you can work with the color selectors here to pick whatever color you want visually.
02:16When you select a color, you'll see that the background attribute was added
02:19to the stack panel.
02:21The value for this is a 32-bit color space constituting a red, green,
02:25blue, and alpha color.
02:26This is shown in hexadecimal numbers very similar to working with CSS and websites.
02:31In C#, there are a number of named color values as well that you can use
02:35English names to select.
02:36You can enter those into the Code view with the Background attribute.
02:40For example, we can change this color to Orange; just remove the hexadecimal
02:44value that we have here, and I can type in the phrase "Orange."
02:48You'll see that the code hinting will automatically give you the named values of
02:52all the colors that you can select.
02:53We can use things like dark violet, deep pink. And, all of these named values are
02:58linked to specific colors.
03:00So, between the Properties panel and the Code panel, you can change the color using
03:03the color picker, your hexadecimal values, or using static names that are
03:06predefined in Windows Phone.
03:08But let's think a little bit about what makes Windows Phone unique.
03:11One of the big tenets of the platform is the personalization you can give your phone.
03:15Your start screen is personalized by your tile arrangement, size, position, but
03:20also through a theme color that you can select.
03:22This theme is the user's way of making the phone their own; it makes it personal for them.
03:27When building apps for Windows Phone, you want to measure your app as an
03:30extension of that personalization.
03:32Lucky for you, the theme color that a user selects is a style or static resource
03:37that you can use to customize the colors in your app.
03:39Let's walk through how to use them.
03:41With the object selected, we want to switch the color picker in the Properties
03:44panel from Editor to Color resources.
03:46With that, you'll see that the color picker is removed, and now you have a list of
03:49colors to choose from.
03:51But these aren't just colors. They are dynamic styles that are linked to user
03:54and system preferences.
03:56The theme color that the user can customize using the phone settings is listed
03:59at the top: PhoneAccentColor.
04:02Let's go ahead and select that.
04:03You will see that the Code panel has updated, and the color is now red.
04:06Le's step through the code and see what happened.
04:09First, you will see that a new set of tags has been created. While you can use
04:12attributes within tags to define values, you can also create child tags using dot
04:16notation in the tag name to set child attributes as well.
04:21In this case, the StackPanel name now has a new child tag called
04:24StackPanel.Background.
04:25Within these tags are the values of the color we selected.
04:28Colors that are used to change backgrounds, borders, or foregrounds are called brushes.
04:33In this case, we are working with a solid color brush.
04:36The color of this brush is set to the system resources, PhoneAccentColor.
04:40Now you might ask yourself, "Big whoop!
04:42It's red. What's the big deal?"
04:43Well, let's change a couple of things, and preview this in other situations.
04:47On the far left, open the Device fly-out menu.
04:50If you're a member from our original orientation, this panel allows you to
04:53customize the Preferences for the Design view panel. In this case, we can change
04:58the theme color of the phone.
04:59Let's go ahead and change it to Lime. You'll see that the color now has changed.
05:04But we didn't have to change a single line of code in our project.
05:07Well, let's go ahead and repeat this again with the second text block that we need to build.
05:11I am going to go ahead and select TOTAL AMOUNT to jump to that area of code.
05:15And then, let's go ahead and create our StackPanel that we'll use to hold our
05:18background color. x:Name to give it a unique name. And, in this case, we will
05:23call it TotalPanel.
05:24We have our automatically created closing tag. And then, I am going to go back
05:28down to our TextBlock.
05:31I am going to right-click, and cut. Go in between our StackPanel opening and
05:35closing tags, and paste. And now, I've got the text block within our StackPanel.
05:40So, let's go ahead back into StackPanel, and now we can start adding in our color again.
05:44This time, instead of using the Properties panel, I am going to go ahead and do
05:47this entirely in code.
05:49So, with our StackPanel selected, I am going to create a new line here.
05:51And, we are going to create a StackPanel.Background tag. Inside of this, I am
05:58going to create a solid color brush tag, and select the color to be a static
06:05resource, which is called PhoneAccentColor.
06:10So, we do the exact same thing we did in the Properties panel, but now we
06:13did it entirely in code.
06:15Again, just to recap. If you take a look, the StackPanel.Background tag we have
06:19here is the same thing we had earlier with the background attribute. It's just
06:22been broken out as a separate XML node.
06:25So again, what we did is we added some color to our app.
06:29Because TextBlocks don't support a background attribute, we got around that
06:32by placing them within the layout container, and then changed their background attribute.
06:36To work with a specific color, you can enter it in, in a few ways.
06:39First, you can use the color picker in the Properties panel. You could enter in
06:43an RGBA value in hexadecimal and code, or you can use one of the dozens of
06:47stored color names.
06:48But another workflow for working with color is to tap into the user
06:51personalization by using the PhoneAccentColor static resource.
06:55When you do this, if the user changes their theme accent color, your app will
06:59automatically update to the new color, and help it integrate with the overall
07:02phone experience for your user.
Collapse this transcript
Working with margins
00:00Spacing and alignment are things you'll want to tweak with each app you create.
00:04In Windows Phone, working with margins is very similar to working with CSS.
00:07You define a margin for the various sides of the box surrounding your object.
00:11In this video, we'll add margins around the new TextBlock components and their
00:15background containers to help add some more visual space to the layout.
00:19If you're continuing from the previous video, you can continue from where we
00:21left off. If not, open the start project for this lesson located in the
00:25downloaded Exercise Files.
00:27The margins for our background containers are off slightly from the objects above it.
00:31If you draw a line, you'll see that the size of the components don't line up.
00:35We can adjust this by adding margins to the containers.
00:38To start, let's select the StackPanel component.
00:41While we can do this in code, I want to show you another way to select it.
00:44On the left-hand side, open the Document Outline fly-out panel.
00:48This shows a hierarchical view of your app, showing the parent containers
00:52for various objects.
00:53This panel makes it easier to select within a complex layout. From this panel,
00:56select the TipPanel object. To close the panel, click the panel name on the left.
01:02With the object selected, we can now add some margins to help space it out on the screen.
01:06Let's do this first using the Properties panel.
01:08Open the Properties panel, and expand the Layout section. This will show you the
01:12layout attribute for the selected StackPanel object.
01:15You'll see here, the bottom of the section, there are 4 boxes representing the
01:19different sides of the StackPanel.
01:21The arrows indicate which side you are changing, either the left, the right,
01:25the bottom, or the top.
01:27Let's start by adding 12 to the left side, and press Enter to commit the value.
01:32You'll notice that the object is now slightly narrower, with 12 pixels of
01:35margin added to the left.
01:37The Design view also displays the number 12 to show you that there is a margin
01:41applied to the selected object.
01:42If you look closely, you'll also see that the TextBlock within the StackPanel
01:46has moved over as well. That is because it is located within the StackPanel, so
01:51it moves with the changes
01:52we made to the StackPanel.
01:53Let's go ahead and add 12 for the other values.
01:56Now there is some comfortable space right in the StackPanel, giving the app some
02:00needed breathing space between the various components.
02:03We'll need to adjust the margin of the TextBlock within the StackPanel.
02:06So, let's select it, and change the values a bit.
02:09First, select the TextBlock. Now it's vertically spaced nicely, so we just want
02:13to change the left and right values.
02:15Let's set them to 10. Again, we'll use the Properties panel to make the changes.
02:19So, open the Properties panel, and change left 10, and right to 10. There, now it
02:25looks nice and spaced out.
02:26Now, let's take a look now at the code that was created for us.
02:29If we look at the code, we'll see that the two margin attributes were added to the
02:32TipPanel and TipAmount components.
02:34In the first example, the margin is set to 12. This means that all four margins
02:38are the same value (in this case, 12).
02:41In the TipAmount component, there are two values separated by a comma.
02:45The first defines the right and left margins (in this case, 10). The second defines
02:49the top and bottom margins (or 0).
02:52Now, while this shorthand is clean, I find it could be confusing to remember the
02:55differences between a single value, a double value, or when there are four
02:59unique values for each side. So, let's expand each of these to show each value independently.
03:05Let's go ahead and first change the TipPanel. So, we're going to go ahead and
03:09change 12 as a single value, and put in 12, 12, 12, 12.
03:15Now, we're actually here to define each one individually.
03:18Again, I find this much more readable than just a single value, because you're
03:21able to distinguish what each value means.
03:23The order of these values are left, top, right, and bottom.
03:28It goes clockwise starting from the left side.
03:30Now, let's repeat this with the other margin setting.
03:32Since we're working with only the left and right, we would want to have 10, 0, 10, and 0.
03:39This defines the left and right with 0 values for the top and bottom.
03:43So, let's go ahead and back into our Margin attribute here. And again, we'll
03:47change this to 10, 0, 10, 0.
03:51Now ultimately, you should see no changes in the Design view, because we didn't
03:54change any of the values. We're just showing them in a more expanded and complete way.
03:58We can also apply these changes directly in code.
04:01So, let's do that to TotalPanel and TotalAmount components.
04:05So, we go into the TotalPanel, just like we did with TipPanel, we could add in
04:10a margin, and set it for 12, 12, 12, 12.
04:15Now let's go to TotalAmount, and we'll add in Margin 10, 0, 10, 0. Great.
04:24So, we got the same result, but this time we did it entirely in code.
04:27So, in this video, we added a margin to some of the layout and text components in our app.
04:32To help select these, we used the Document Outline panel to select objects, and
04:36then apply margin settings to them.
04:37To apply margins, you could work with the Properties panel or you can work with
04:41them directly in code.
04:42In code, the margins can be shown in one of three ways:
04:45a single value that applies equally to all; two values that apply to the left,
04:49right, or top, bottom; or four values starting from the left, and rotating clockwise
04:54around the object; or a left, top, right, and bottom.
Collapse this transcript
Adding a background image
00:00So far, we've only been working with code and properties of objects, but we've
00:04not worked with any external assets like images.
00:07In this video, we will add a background image to our app.
00:09To do this, we need to add the image as a resource to the project, and then create
00:13an image brush that uses the image, and applies it to the object.
00:17Let's start by adding an image to our project.
00:20Again, just like previous videos, if you are continuing from the last video, you
00:24can keep the project that you currently have open, or you can open the start
00:27project from the Exercise Files.
00:29If you look at the Solution Explorer, you will see that there is a folder called Assets.
00:33If we open this folder, you'll see that there are some images and bitmaps that
00:36are already in there.
00:38These are where you place images that are used in your project.
00:40The images that are here now are placeholder images for our application icons, which
00:45we'll customize in a future chapter.
00:46In order to work with an image in our project, it needs to be added. We can do
00:50that here in the Solution Explorer.
00:52We are going to right-click their Assets folder; select Add>Existing Item.
00:58From here, navigate to where you save the Exercise Files;
01:01you'll see a folder called assets.
01:04There is a JPEG image in here called appBackgroundImage. Select it, and click Add.
01:10You'll see that the image is added to the folder in the Solution Explorer.
01:13Now that it is added, we can start working with it, and add it to our layout.
01:17We have been working so far in the Title panel or Content panel sections of
01:21the Mainpage.xaml file.
01:23But if you go to the top, you will see that all these are located within a grid
01:26object called LayoutRoot.
01:28The LayoutRoot is the parent Layout container for the entire application, which
01:32is why it's listed first in the file.
01:34Since we want to add a background image, we want to apply it to the LayoutRoot,
01:38so it'll be visible in all the sections of the app.
01:41Let's start by selecting the layout grid component, and open the Properties panel.
01:45In the Properties panel, we apply colors to backgrounds before. In code, these
01:49are referred to as solid color brushes.
01:52Images are also brushes.
01:55In this case, they are called Image Brushes.
01:57We can add an image brush to our layout by selecting the Image Brush option.
02:02Now let's select our image. The ImageSource drop-down shows the contents of our
02:06Assets folder, so we can select appBackgroundImage.jpg.
02:10By default, the Stretch setting will be filled. This will fill the area with the
02:14image, but this could distort the image if it isn't proportionally the same as
02:18the box it is being placed within.
02:20With Windows Phone 8, there are three resolutions. Each resolution has a
02:24different height or width, so while it may look good here, on another device, it
02:28might not look right.
02:29We can change the Stretch setting to Uniform.
02:31This will place the image, so it won't scale incorrectly. But it accomplished
02:35this by stretching the pixels in the size to fill the space, in this case, at
02:39the top and bottom.
02:40The final option, which is what we want, is called UniformToFill.
02:43This will scale the image, but keep it proportionally correct, and center
02:47it within the area.
02:48Now we have one final thing to change.
02:50As you can see, the image is pretty intense in color, and it can be hard to see
02:54with the text on top. We can apply an Opacity or Transparency setting to the
02:59image brush to darken it slightly.
03:01The Opacity setting is hidden by default, but if you click the chevron, you will
03:05be able to expand this, and show the Opacity value.
03:07In this field, we are going to change Opacity to 70.
03:10There. Now we have the right intensity, and we can read the controls on top.
03:14Now, in the previous video, we talked a little bit about the AccentColor of the
03:17phone, and how it can be changed.
03:20In addition to that, the user can also change if they want the phone to have a
03:22dark background or a light background.
03:25We can see what the apple looked like with a light background using the Device panel.
03:29Let's go ahead and open up the Device fly-out, and we can change the Theme
03:32from Dark to Light.
03:34You will now see that the app has switched colors on us.
03:36Now, instead of white text on black, we have black text on white.
03:40You'll notice, though, that the intensity of the background image is still applied,
03:43making the controls and text still legible, even though we've changed the theme.
03:47It is important to consider how theme adjustments can affect your app.
03:51If we were hard-coding the color values to make everything white, we would have
03:54an unusable app, if the user preferred a light theme.
03:57This is why working with static resources and previewing them in various
04:00scenarios can really help prevent design challenges.
04:03So, let's look back.
04:04In this video, we covered how to work with external assets.
04:07External assets like images, need to be added to a project before you can use them.
04:11You do this using the Solution Explorer, and add the existing item to the Assets folder.
04:15We can access the LayoutRoot grid component, which is the top parent layout
04:20container for the project, and add an image brush to the component.
04:23After selecting the image, we adjusted the Stretch properties to get the right look,
04:27and then adjusted the opacity to create a good balance with the rest of the app.
04:31Finally, to preview what this would look like with a light-colored theme, we used
04:35the Device menu to change the theme from dark to light.
04:38So, that was a lot of work, but now that we have the user interface complete, we
04:42can now start building the logic for our application, which we'll do using C#.
Collapse this transcript
5. Building the Logic
Understanding the starter code and code behind
00:00Now that the visual interface is created, we can start working with the plumbing
00:03behind the scenes, and get our application to work, and respond to events that are
00:07created by the user.
00:08In C#, there is a special relationship to the XAML file and the C# code that drives it.
00:13The most basic definition is that they are two sides of the same coin.
00:16The XAML file represents the layout, and the objects that are in your
00:20application. It defines what is there, how it looks, and how it's arranged.
00:24However, the XAML file doesn't determine what the application does. C# is the
00:28language that we will use to define what happens on the other side of the coin,
00:32what happens when the user works with the application.
00:35Now, for our tip calculator application, the actions will be pretty basic. We want
00:38to take the amount that the user entered, multiply it by the tip percentage,
00:42display the tip amount, and then add that to the original total to get the final
00:47total, including the tip.
00:48This is the logic of the application, and we will build this using C#.
00:51Windows Phone 8 supports multiple languages for your app development. You're
00:55using C#, in this case, but you can also use Visual Basic or C++, if you're
01:00familiar with those languages.
01:01I should also point out it is possible to build your application entirely with
01:05C#, and not use XAML. This is because every object you're creating in XAML is
01:10actually a C# class or object that is represented as XAML tags.
01:14Object or class properties are exposed as tag attributes. While this is possible, I
01:19wouldn't recommend this at first, because it can get confusing.
01:22But you will come across times when you need to create visual components as the
01:25app runs, and process the application logic.
01:28It is possible to do this since all the components are C# classes.
01:32Now, when you create a new project, the MainPage.xaml file is created for you.
01:36Along with that is the MainPage.xaml. cs file (the CS extension stands for C#).
01:42This is called the code behind file. Again, think of this as the backside of the
01:46coin, defining more of what the application does. In fact, in the Solution Explorer,
01:51it is collapsed within the XAML file.
01:54Now let's work with the project we finished in the last video to see the code behind file.
01:58If you're continuing from the previous video, you can work with the file you
02:01already have open. If not, go ahead and open the start project for this video
02:04from the downloaded Exercise Files.
02:06With the XAML file open, you might ask, "Where is the code behind file? You already
02:10are looking at code."
02:12Well, if you go to the Solution Explorer, twirl the disclosure triangle for the
02:15XAML file. There is the xaml.cs file, which is the code behind file for this
02:20XAML document. Double-click it to open the file in Visual Studio.
02:24You'll notice the Visual Studio layout changes when you open this. Now that we
02:27are working with application logic, there is no Design view. That is because
02:31we're no longer working with the XAML Design layer of our application. We're now
02:35working with the logic.
02:37So, let's go ahead and step through a bit of what's going on here.
02:40So, at the top, from lines 1 through 10, are a number of using statements. These
02:45statements are referencing other classes and objects outside of our project to
02:49be bundled and accessible from this code file.
02:51On line 12, we start the code for the file by defining a namespace, in this case
02:56the name of our app, and then create a constructor on lines 16 through 23.
03:01Now, if you aren't familiar with object- oriented programming, the constructor is
03:05essentially what is run first when the file runs. It constructs the project, and
03:10gets everything set up.
03:11You'll see a lot of code here is colored differently than the rest the code. These lines
03:15are commented out, meaning that they have been converted to non-executable code.
03:20These lines, if you remove the double slashes (//) in front of them, will add an
03:23application bar to your project.
03:25Our project doesn't need an app bar, and we can remove them safely
03:28without harming anything.
03:30Let's go ahead and do that to make the total a little bit easier to read.
03:32So, I am going to select lines from 25 to 39, and then I am just going to press Delete.
03:38We can also select lines 21 through 22, and delete those as well.
03:42When we start adding our code to this, we're going to do a few things. First,
03:46we're going to define, in our code behind file, any variables we're going to work
03:50with in our project.
03:51Next, we'll create an event trigger in our XAML file that will listen for when an
03:55event takes place with a component, and then execute a named function of code in
03:59this code behind file.
04:00For example, if the 15% button is pressed, you want to calculate tip. The XAML
04:06code will listen for the user to do something, and when it does, execute a piece
04:09of code in the code behind file.
04:11We could get all tricky and ultra streamlined with the code, but we're going to keep it simple.
04:15We'll have some repetition, but it will help reinforce some of the concepts
04:19you'll find when working on your own with Windows Phone 8.
04:22So, with our basic overview of how the code behind file relates to your project,
04:26let's go back to the XAML file, and start creating some triggers.
Collapse this transcript
Building event handlers for components
00:00In order for applications to respond to user events, we need to tell the app which
00:04user events we're going to respond to.
00:06In this video, we'll add event listeners to our XAML components that will trigger
00:10functionality in our code behind file, when specific user events take place.
00:14When we're done with this project, we will add tap events to each of our tip
00:18percentage buttons, and make sure they all respond to user events.
00:21To get started, if you're coming from the previous video, you can keep working
00:24with the project you currently have open. If not, open the Start project for this video.
00:28We'll be working with the MainPage.xaml file, so let's go ahead and open that up.
00:33Adding listeners to events sounds complicated, but it actually is quite easy,
00:37Visual Studio handles a lot of the grunt work for you.
00:40Let's start with one and see how it works.
00:43In Design view or Code view, select or navigate to the 5% Button, named Percent5. In
00:49the Button tag, navigate to the end of the tag.
00:51We're going to add a Tap event listener. This will listen for the Tap event, and
00:56then execute a named block of code.
00:57So, to add this, we're going to go again to the end of our Button tag, and
01:02then add in Tap. And, you'll see that Visual Studio will show something that
01:06says New Event Handler. This is the code hinting support in Visual Studio asking if
01:11you want a New Event Handler, or named block of code, to be created for you to
01:15tie into this event.
01:16By default, the name of the event handler is named the same as the object, and
01:20underscore (_), then event type, and then a sequential number.
01:23So, if I press Tab, you'll see it comes up as Percants5_Tap_1.
01:29So, we have created a listener, but what about the code behind file? All right,
01:33let's go ahead and take a look. So, open up the xaml.cs file, and let's
01:38scroll down to line 22.
01:41You'll see that the code was created for you. Now, this code doesn't actually do
01:44anything, but the overall framework is now here for you to start building from.
01:49Now, we want to test that everything is working correctly.
01:51So, let's add some code into the Event Handler that will alter the text in the
01:55tip amount: textblock.
01:57If you remember, the textblock was a xaml object that we created. And, we discussed
02:01before, XAML objects are just classes. And, attributes we access in <xaml> tags, we
02:06can also access using dot notation as object properties in C#.
02:11So, if there is a text attribute in XAML for the tip amount textblock, there
02:16is then also a text property that we can access in code.
02:19So, let's go ahead and try it.
02:20So, inside of my code block here, between the two braces on line 24, I'm
02:25going access TipAmount.
02:28You'll see that Visual Studio will recognize that we already have an object called
02:32TipAmount. I can press Tab to complete the line.
02:35Then, I'm going to use the period (.)
02:37to access the attributes or properties of this object, and then access Text.
02:42Again, the code hinting support will show that this is a recognized property
02:46when I can press Tab.
02:47We're going to set this = "5%." And, with C#, you need to end all of your lines with a semi colon (;).
02:54There.
02:55So, let's go ahead and try this now in the simulator, and see how this works.
02:59Now, although we're using the mouse, the simulator is translating the mouse clicks to taps.
03:03So, when we click on the 5%, it registers the event, triggers the event handler,
03:08and executes the code we created.
03:10So, now that we got this one working, let's go ahead and create the other four.
03:14So, I am going to go Stop this, and then we're going to go back into our xaml file.
03:18And, we're going to replicate the same process that we did with this Tap event,
03:23and we're going to apply that to the other four.
03:25We're going to create Tap event, and we're going to create a New Event Handler.
03:29So, now we have all five of our XAML event listeners, and now we can go back into
03:33our code behind file, and finish out the code.
03:36As you can see, again, all the different code blocks have been created for us. We
03:40now just have to access the text property of the TipAmount, and make the value
03:44appropriate for the percentage that we have clipped.
03:46tipamount.text=10%. Go to the 15%, tipamount.text=15%. tipamount.text=20%. And,
04:02the last one. TipMmount.text = "25%"; there.
04:09So, let's go ahead and save this, and try it again in the emulator, and see how it works.
04:13We can try it 5, 10, 15, 20, and 25. Great. So, now all the tip percentage buttons
04:20are now responding to the user events.
04:22So, to recap, in this video, we created an event listener for a XAML component
04:27that would kick in whenever a specific event took place on the object.
04:30When that happened, an event handler is then executed. When we created the listener
04:34in code, Visual Studio created an empty handler for us.
04:38In addition, we also accessed properties or components in C#, instead of XAML, to
04:43make changes based on user input.
04:45In C#, we have worked with object properties of the instance name, which we
04:49defined using x:Name attribute in XAML.
Collapse this transcript
Building application logic
00:01Now it is time to build the meat of our application.
00:03In this video, we're working mostly in C#, but we will do some tweaking in XAML as well.
00:08So, here is a preview of what we're going to do.
00:10First, we will create some variables to hold some of the internal values we will
00:13use in this app, and populate those variables with values.
00:17Second, we will create a named function that will calculate the tip.
00:20Within this, we will grab the value input from the tip amount text box, and
00:24manipulate it to determine the tip amount.
00:26Finally, we will display the tip amount and the total price on the screen.
00:30At the end, we will build to enter in a service or bill amount, select a tip, and
00:36then display the tip amount and total amount on the screen.
00:39We need to store some values and variables for our calculator to work.
00:42These values will store the tip percentage in the amount entered by the user.
00:46Let's go ahead and go back into Visual Studio, and we can get started.
00:49We will be using floating point numbers to store these values, since they
00:53contain decimal numbers.
00:55So, let's go inside of our code here, and above the Constructor, I am going to
00:59create a couple of lines.
01:01Now, to create this decimal number, we're going to use a float.
01:04Type in float, and then we give it a variable name.
01:07Again, this is going to can be called tipPercentage.
01:10I am going to create a second one, which we will call serviceAmount.
01:14Now, with these two variables created, we can start working with these inside of
01:18our event handlers that we've already created.
01:20Now, we don't want to actually show this TipAmount text anymore, so we can comment this out.
01:26A comment, if you remember, starts with two forward slashes (//).
01:30I'm going to quickly just go through these, and comment these out, so that these
01:33lines of code won't run.
01:35Now that we have the tipPercentage variable created for us, we can then set that
01:39to the value that's appropriate, based on the button that the user tapped.
01:43So, let's go ahead and do that now.
01:45We're going to access our tipPercentage, and we're going to set that to .05.
01:50Now, since we're working with a floating point number though, we need to end
01:53this with an f. That defines that this value is a floating-point number.
01:58So, then continue to do this for the other ones.
02:00So, for this one, for 10%, tipPercentage=.1f, tipPercentage=.15f, tipPercentage=.2f.
02:15And, then the last one. tipPercentage=.25.
02:19The next step is to create a named function for our tip calculator, and add in
02:23the code to calculate the tip in total.
02:25We then need to start this function at the end of each event handler, and have it
02:29set the tipPercentage variable.
02:31We need to start doing some type conversion however.
02:33The reason is because the type of value that is stored in a text box is a string
02:38or a chain of letters and numbers.
02:40The number we need to store is a floating point decimal or a float.
02:43We will need to convert the string to a single precision number in order to work
02:47with it mathematically.
02:48Essentially, you can't do math on a string, so we have to find a way to
02:52convert it to a number.
02:53Okay, so let's now go inside of our code, and add in our new function.
02:57We're going to create a private void function. We're going to call it
03:02CalculateTip (). Have an opening brace {, closing brace }. And, we have got the
03:09basic structure set up.
03:11So, let's go back into the event handlers here, and access that
03:14CalculateTip method.
03:18So now, with those created, when a user taps on a button, it will set
03:22the tipPercentage variable, and then all of these functions will
03:25execute CalculateTip.
03:27So, let's now go back down into CalculateTip, and start working with our variables.
03:31Now again, we're going to work with the serviceAmount, and we need to access the
03:36Amount.Text value in our XAML objects.
03:39Now again, if you remember, I said that we had do to some conversion.
03:43If I mouse over this, you will see that the arrow says, "Cannot implicitly convert
03:47type string to float."
03:48This is what I was mentioning before is that we can't take a string value, and
03:52perform mathematical functions to it, or assign it to a mathematical variable.
03:56Now, to get around this, we can use the System.Convert method, and convert this to
04:01a single floating point number.
04:03So, I am going to in the beginning of this, and access System.Convert.ToSingle.
04:09Now, this will then convert this into the right format, and you'll see that the
04:13squiggly lines go away, because now we are taking the text value, and we're
04:17converting it into a single precision floating point number.
04:19Let's create a couple of other lines, and we're going to create some temporary
04:23variables that we're just going to use inside of this method.
04:25I am going to create a float called tipAmount, and again, the tipAmount is going
04:30to be based on the serviceAmount * tipPercentage.
04:36Then create another one, float totalAmount, which will be the serviceAmount + tipAmount.
04:44With the new method, CalculateTip created an access with each event handler.
04:48We're now calculating the tip, storing it, and then calculating and storing the
04:52total of the entire bill.
04:53And now, we need to display this in the app.
04:56The trick, though, is just like we did the conversion from text to decimal before,
05:00we now know how to do it in the opposite direction, going from decimal to text.
05:05Now, one of the easiest ways to do this is to use a string formatter.
05:09A string formatter will allow us to insert a decimal or numerical value inside
05:13of a string, and then allow us to then assign that to a text property.
05:17So, after each one of these lines, we're going to go ahead and access TipAmount,
05:22and the text property of that. And, we're going to use a string format,
05:26String.Format, and the string format looks a little like this.
05:31So, let me explain exactly what this is doing.
05:34We have a string here;
05:36in this case, it's a pair of braces with a zero inside of it.
05:39Now, this isn't actually going to be part of the string. This is a token that's
05:43going to take the value that's to the right of the comma, tipAmount, and insert
05:47that inside of the string, replacing the token.
05:50It will then take this entire string, and format it, and assign it to the text property.
05:54Let's go ahead and repeat this the second time. In this case, we'll
05:58take TotalAmount.Text, and we'll use the String.Format again, and we'll
06:03access totalAmount.
06:05Okay, so now let's go ahead and run this, and see how this looks.
06:09So, I can go up here to the top, and then we can enter in a value, and then put in a percentage.
06:15So, as you can see, everything generally works, but there is still little bit
06:18more that we can do.
06:20One final touch we can do here is to add some special formatting for the text.
06:24Since we're dealing with currency, we can alter the string formatter to display
06:27the output as currency.
06:30This will also display leading and trailing zeroes if we need them, and round
06:33based on the second decimal point.
06:36So, to do this is actually pretty easy.
06:38Let's go back into Visual Studio, and stop our debugging, and after each of these
06:42zeroes, put a colon and a C. C stands for Currency, so now I can run this again
06:48in the Emulator. We'll go ahead and enter in the same amount, twenty dollars and
06:5350 cents, and then we click the percentage.
06:56And, as you can see, now it has the dollar sign, and it has the correct number of
06:59decimal points for a currency number. So let's recap.
07:02So, in this video, we created the basic functionality for our tip calculator app.
07:06Along the way, you picked up some basic C# skills as well.
07:09We created some variables to work with floating-point numbers, and grabbed the
07:13value of a text field, converted it to a decimal number, and used it to calculate
07:17the tip based on the amount requested by the user.
07:20We then converted that back to a string, formatted it as a currency, and
07:24displayed it back in the app.
07:26There are a few more enhancements we can make to the app.
07:28For example, when the app starts, we currently display placeholder text for the tip in total.
07:33We can hide these, and display them when we have real values to display, and we'll
07:36do that in the next video.
Collapse this transcript
Adjusting the layout
00:00In the last video, we added the core tip calculator logic to our app.
00:04In this video, we will add some refinements to help polish some of the edges.
00:08Now, this project that I have currently open is from where we were at the end of the last video.
00:12When we start the app, we display, at the bottom of the screen, the header and text
00:16for the TIP AMOUNT and the TOTAL AMOUNT.
00:18The thing, though, is we don't actually have anything to really put into these
00:21areas when the app starts. Since they would be empty, our application would have
00:26more focus if we didn't display them when the app launched. And, I want to show
00:29them when the app has information to display there.
00:32What we're going to do in this video is to adjust the display of some of the
00:35objects in our project.
00:36We will first hide them when the app starts, and then, when the tip is calculated,
00:40we will display them along with the actual values.
00:43So, let's go ahead back into Visual Studio, and get started.
00:46The first thing we need to do is go to our Constructor.
00:48Remember when I said in a previous video that this is the first thing that's
00:53executed in our project?
00:54Since we want to hide them when the app starts, this is the perfect place to do that.
00:57Visual Components in Windows Phone 8 have a property called visibility.
01:01We can access this property, and set it to a specific named value to change its
01:06visibility from visible to collapsed.
01:09So, let's go up to the Constructor, and see how this works.
01:11So, we're going to go ahead and create a new line of code. We're going to access
01:15TipHeader, and we're going to access the Visibility property.
01:19Now, this isn't set to a specific string or other value. This is set to a named
01:24property called System.Windows.Visibility.
01:29Then, we access two other properties:
01:31Collapsed or Visible.
01:32Since we already have it visible, we want to set this Collapsed.
01:36So, let's go ahead and run the application, and see how this changes the way it looks.
01:40You'll see that the TipHeader text that was above the tipAmount is no longer
01:43visible, but you'll also notice something else.
01:46The space isn't just blank;
01:47everything else is shifted up to fill in the space.
01:51That's why the Property is called Collapsed.
01:53Let's go back into the code, and we can add this to the other objects that
01:56we want to collapse.
01:57Let's go ahead and stop the debugging, and we'll go back into our code, and we'll
02:01access the other properties. TipPanel.Visibility =
02:06System.Windows.Visibility.Collapsed.
02:10TotalHeader.Visibility = System.Windows .Visibility.Collapsed. And then, finally,
02:18our last one. TotalPanel.Visibility = System.Windows.Visibility.Collapsed.
02:26All right. So, now let's go ahead and run this app again.
02:29So, as you can see, they are now no longer visible in the app, but now we have
02:32the opposite problem.
02:34If I go in and start typing in a value, and access a percentage, we now no longer
02:38display them at all.
02:40So, now I have to actually go back into the code, and display them when they have
02:43appropriate values to show on the app.
02:45Let's go ahead and Stop Debugging, and go back to our code, and go down to our
02:49CalculateTip method at the bottom.
02:51Now, just like when we worked with Collapsed, the opposite of that is visible.
02:55So, after we've set the values here in our CalculateTip method, we can go
02:59into this, and we can insert the same code that we had before, but instead of
03:03Collapsed, put in Visible.
03:05We'll put in TipHeader.Visibility = System.Windows.Visibility.Visible. And, we'll
03:12do this for all of the other ones as well.
03:14So, now let's go ahead and run the app again, entering a bill amount. And, now
03:21everything displays correctly.
03:22But there is one more enhancement we can make.
03:24If we calculate the tip once, and then go back and edit the amount, the original
03:31tip displays would still cause a little bit of user confusion.
03:35We can listen for a specific event, and hide the tip and total if the user
03:40manipulates the value of text box.
03:42To do this, we need to add a manipulation- started event listener in our XAML file
03:46for the text box control.
03:48So, let's go ahead and Stop Debugging, and this time, let's go into the XAML
03:51file. And, I am going to scroll down, and select our text box control here, which is called Amount.
03:59Now, inside of this, we want to access the new manipulation-started property.
04:04So, I am going to go the end here, and add ManipulationStarted, and I will create
04:09a New Event Handler.
04:11Now, we can go into the Event Handler that was just created, and add some code to
04:15hide the components that we don't want to see.
04:18Since we already have it hidden when the app starts for the first time, we can
04:22add an if statement to test if it's hidden, and then skip the code.
04:25So, we're going to go back into the C# file, and if we scroll down, we'll see we
04:30have that new line of code created here.
04:32So, I am going to create an if statement that will test to see is
04:36TipHeader.Visibility already set to System.Windows.Visibility.Visible.
04:43If it is, then we want to hide it in this particular case.
04:46So, I am going to create an open brace, and then a closed brace for our if statement, and
04:50then inside this, we're going to go ahead and take the TipHeader, and we can
04:55repeat the same code that we had up earlier.
04:57Now, you can also copy and paste this from the top of the code. I am just going
05:01to type it here just for completeness.
05:03So, let's go ahead and run the code, just to make sure that everything is working correctly.
05:07So, again, we're not displaying the text fields in the beginning. Let's go ahead
05:11and add in our value, calculate the Tip, and now we display them.
05:16But now, when we click back into this, you'll see that the two values will go away.
05:21That's because we've now started to manipulate the value inside of this text box,
05:25which then hides the boxes from displaying.
05:28Great, so let's recap for little bit.
05:31We took the basic logic we took in the last video, and added some
05:34basic enhancements.
05:35First, we accessed the Visibility properties to collapse items that aren't
05:39needed when the application first starts up, then display and re-hide them when necessary.
05:44There is one last step we need to take, and that is to handle some possible
05:48errors that can exist in our application. And we will cover that in the next video.
Collapse this transcript
Handling errors
00:00We now need to put our attention to making sure the application doesn't crash or
00:04have any unexpected errors.
00:06There currently are a couple that exist that we need to check for, and then
00:10notify the users that there are issues that they then need to resolve.
00:13If you're continuing from the previous video, you can work with the project
00:16you already have open.
00:17If not, open the start project for this video in the downloaded Exercise Files.
00:22Let's start the application and the simulator, and see what issues we have.
00:24Let's start with not entering anything into the amount text box, and jump right
00:29into trying to set it to percentage.
00:32As you see, the application shuts down.
00:34That means we have an error or a crash.
00:36On a physical device, the exact same thing would happen.
00:39Now, if this was currently in Debugging mode with Visual Studio, you would then
00:43send a message back to Visual Studio saying that we had encountered an error.
00:47So, let's go ahead and restart, and show one other possible error.
00:51We could enter an amount, but accidentally put in two decimal points.
00:57If we calculate again, we also get the same crash like we had before.
01:02Now, because the app is very simple, there aren't many issues that could arise.
01:06But the errors that do happen are due to the fact that the user can enter values
01:10that can't be converted from strings to decimals.
01:13We can create a block of code that will detect if there is an error, and route
01:17the execution of code to do something to notify the user.
01:20Typically, Windows Phone applications' feedback to the user is very simple and basic.
01:25In this case, we can change the border of the text box to red, indicating that
01:29they've entered in an illegal value.
01:31To do this, we need to place our code within a try catch block.
01:34Let's go ahead and go back into Visual Studio.
01:38In the try catch block, we will execute our code.
01:41If there's an error, we will route to a catch block that will change the border
01:45color to red, and then wait for the user to fix the issue.
01:49If the user fixes the issue, then we will restore the default border color to the text box.
01:54So, let's go down to our CalculateTip method, and put our code in there.
01:59So, what we're going to do is we're going to add a try statement here.
02:04This is then going to try and execute the code within the text block. So,
02:09we're going to open this up, and then we'll go down here to the bottom, and then
02:13we will close this.
02:15Now, if there is an error here, we need to catch that error, and have a
02:19special section that's going to execute what we want to happen if there is
02:22an error encountered.
02:24So, we'll add a catch, another pair of braces, and then, inside of these braces,
02:30we're then going to access Amount.BorderBrush.
02:36Now, the BorderBrush property is that outside edge of the text box.
02:40Just like when we were working with colors before, we can access the BorderBrush. But in
02:45this case, since we're not working with XAML, we need to create a new solid
02:49color brush object in C#.
02:52So, we'll create a new SolidColorBrush.
02:58You'll see that there is a little squiggly line that appears underneath here.
03:02The issue is that solid color brush is not currently part of the project.
03:06To fix this, we can press Ctrl+Period (.).
03:10When you do that, you'll see that there is a new dropdown that shows where we
03:13can add in the using statement that will allow a solid color brush to be added into the project.
03:19So, if I go ahead and click that, you'll see that solid color brush now
03:23changes color, and the red squiggly line goes away.
03:26Just to prove this, I am going to go back up to the top, and you'll see that using
03:31System.Windows.Media is now added to our project.
03:34So, let's go ahead back down to the bottom, and now we're going to set
03:37SolidColorBrush to Colors.Red.
03:44If we run this now, and we encounter the error, it will execute this code.
03:49But if the user fixes the error, it will still maintain a red color around it.
03:54So, now we need to change inside of our try block to set this back to the system
04:00border brush that's the default for the application.
04:03So, now we're going to put in Amount.BorderBrush, and we're going to set this to a system property.
04:13If you remember these system resources were accessed in a specific way in XAML.
04:18For C#, there is a new format that we have to use.
04:21We're going to access a SolidColorBrush type, and we're going to set this to
04:26the ApplicationCurrentResources, and we're going to access the resource PhoneBorderBrush.
04:39So again, we have the AmountBorderBrush, and we're accessing a system resource
04:44called PhoneBorderBrush, which is the default BorderBrush color that's part of
04:47the system resources.
04:49Now, we're able to assign that to the BorderBrush by using the
04:52SolidColorBrush type.
04:54So, now we are able to access the error if it happens.
04:57So, let's go ahead and run this again, and try to repeat the same errors we had before.
05:04So, now if I try to execute 50% without entering an amount, you'll see that
05:10now that application does not crash, but it does display the red BorderBrush
05:14around our text block.
05:15If I go in here, and enter in a correct amount, and then press 15 again, the
05:22BorderBrush goes away, back to the default color.
05:25The other error that we had was by entering in two decimal points.
05:30If I execute this again, you'll see the red BorderBrush now appears.
05:34So, as you can see, both of our previous issues have been detected by the error
05:38handling, and we're now getting feedback to our user to adjust the entry to fix
05:42the error, and get the desired result in the application.
05:46With that, we've now finished the core coding of our application.
05:48In the next chapter, we'll dive a little deeper into working with the simulator, and
05:53how you can test your application on a physical device that is connected to your
05:56computer, and test in a real-world environment.
Collapse this transcript
6. Testing
Testing our application in the simulator
00:00When you're working with your application in Visual Studio, you have two options
00:03on how you want to test your application.
00:06You can test on your machine with the Windows Phone Emulator, or you can test
00:09with a connected device.
00:11There are advantages and disadvantages to each, and here are some reasons why.
00:14With an Emulator, you can test on the three resolutions that are part of the
00:18Windows Phone ecosystem:
00:19WVGA, WXGA, and 720p.
00:23WVGA is 480�800; WXGA is 680 �1280; and 720p is 720�1280.
00:31The WVGA resolution has two formats.
00:34One is the regular version of the device, and the other has 512 megabytes of RAM,
00:39which is designed for emerging markets to keep a lower price point.
00:42As you can see, the biggest advantage to the emulator is that you have access to
00:45all of these device types without needing to invest in the hardware.
00:49The drawback with an emulator, though, is that although you can approximate the
00:53speeds of native hardware, it will never be exactly like it.
00:56In addition, you don't have the same tactile experience with an emulator that
01:00you do with a physical device.
01:02So, you aren't testing it in a completely real-world environment.
01:05That being said, there is a lot you can do with an emulator, and in this
01:08video we'll go over the various features of it to help you test your Windows
01:11Phone 8 applications.
01:13So far, we've only worked with the default emulator, the 512 megabytes WVGA Emulator.
01:18If you expand the menu, you'll see each of the other ones listed as well.
01:23Each one is a different emulator instance.
01:25While you can have multiple emulators running, only one can be connected to the
01:28Visual Studio IDE at once.
01:31Let's launch one of the other emulators, and just take a look at it in more depth.
01:35In Visual Studio again, open up the drop-down, and let's go ahead and select WVGA Emulator.
01:40This is the same resolution as the Nokia 920, one of the leading phones of the platform.
01:45The 720p emulator matches the resolution of HTC's Windows Phone 8x.
01:50Let's go ahead and start the emulator by clicking on the button.
01:53With the emulator loaded, the buttons at the bottom map to the captive touch
01:57buttons on a physical phone:
01:58back, home, and search.
02:00You can navigate through the phone as if it were a real phone.
02:03You can swipe to display the menu of the various applications, and you can
02:08navigate it, install and uninstall apps as well.
02:11To the right of the device window are some control buttons to help you work with
02:15the emulator better.
02:16You can close the emulator, you can minimize it, you can rotate it, you can
02:20increase the magnification, and you can also access some advanced options.
02:24For example, if I wanted to rotate the emulator, I can then click this button,
02:28which will rotate it, so that it's now showing it in a landscape format. You can
02:33rotate it clockwise or counterclockwise.
02:35The magnification allows you to increase the size of what you're
02:39actually looking at.
02:40In this case, this is allowing us to change it so that will fit within the window.
02:44We can also click this button to change the zoom entirely.
02:48If you select 100%, it will do a one-to-one pixel match with your
02:51current resolution.
02:53As you can see, it's too big to fit into our display here, so you can also scale
02:57this back, and we'll do it to say, like, 50 or 66%.
03:02Let's go ahead and open up the expanded menu, and take a look at some of the other options.
03:05In the expanded menu, you can adjust the phone in 3D space to simulate motion
03:09for how the accelerometer works.
03:12You can change it using these different various orientations, or you can click
03:15this button, and you can actually rotate it in space.
03:18This will send this data to the accelerometer inside of the virtual phone, so
03:22you can actually track and use this if you're testing your application.
03:26You can send all this information from the accelerometer to your app, to test
03:29how it's working inside of this environment.
03:32In addition, there is a recorded shake motion here.
03:35If you click Play, the X, Y, and Z will automatically shift all kinds of
03:39different values to simulate the phone being shaken.
03:42The next tab is Location.
03:44On the phone, I'm going to use the Map app.
03:47As you can see, the default location is Redmond, Washington, the home of
03:50Microsoft's headquarters.
03:52In the map, I can zoom out, and pick a different location.
03:54Let's go ahead and pick San Francisco, where I live.
03:57If I click on the map to add the point, you'll see that the map on the
03:59phone will also move.
04:02The interactive map on the right is faking the location, and sending that fake GPS
04:06information to the device, which then uses that information in the Map app.
04:10I can turn Live mode off, and create a number of waypoints, by clicking on the map as well.
04:14I am going to turn Live off, and then I can actually click, and zoom into this. I
04:19am going to start adding in waypoints.
04:22After you add the waypoints, you can then click Play, which will then simulate
04:26you going from each waypoint to waypoint, and then sending that information to
04:30the GPS on the phone.
04:34You can also save these map points as a file, so you can load this up later, and
04:38retest using the exact same parameters that you've used before.
04:41The next tab allows you take screenshots of your phone.
04:44This is great for taking screenshots of your phone, which you'll need when you
04:47send this to the Windows Phone Store to show off how your application looks.
04:51This works pretty basic. You start with by clicking the Capture button, and
04:55then you can save it.
04:56Notice it also shows the resolution of the phone.
04:58Finally, there is a Network tab, which also shows you some of the adapter
05:02information specific to the emulator.
05:04So, those are the basics of the Windows Phone Emulator.
05:06So, as we talked about, the emulator is great for testing your app at various
05:09resolutions, and to help simulate data like Accelerometer and Geolocation.
05:13It is also perfect for taking screenshots of your app to prep for submitting
05:17to the App Store.
Collapse this transcript
Testing our application on a connected device
00:00Working with a physical device is very straightforward with Windows Phone 8.
00:04Essentially, it's a two-step process.
00:06You first register your device as directly addressable through Visual Studio and
00:10the SDK. And then, instead of picking the emulator, you select "device" from the
00:14target menu, and off you go.
00:16To start, we need to register the phone with the computer.
00:19There is an application that does this called the Windows Phone
00:21Developer Registration.
00:23This takes your phone's ID, and registers it with your account.
00:27If you go to the Start screen, and then you right-click, and select All apps,
00:31you'll be able to see that all the way on the right, under the Windows Phone SDK 8.
00:37Let's go ahead and launch the application. And, it's currently actively
00:40looking for your phone.
00:42Let's go ahead and attach our phone to the computer using a USB cable.
00:48If your phone is locked, meaning that the lock screen is currently on, turn it
00:52on, and swipe up, and insert your lock code if you need to.
01:01Now, click Register, and sign in with your Microsoft Developer account.
01:08If you haven't set up your App Hub, or your Developer account yet, we'll be going
01:12over more of that information in the end of the course.
01:15Now, after you're signed in, your phone will then be added to your Developer account.
01:19And, now you're ready to send your app to the phone.
01:21So, let's go ahead and click close, and we're back in Visual Studio.
01:24Now, instead of working with an Emulator, we can say Device.
01:29If we go ahead and click Play, it's then going to build our project. And now,
01:33instead of sending it to the Emulator, it's going to install and send this
01:37directly to your connected device.
01:43As you can see, on this phone, I can now tap and interact with the
01:46application, just like I did in the emulator, but now it's working on an
01:50actual physical hardware.
01:53There is one other application that comes with the SDK that I wanted to point out to you.
01:57If you look in the Windows Phone 8 SDK folder, within all the apps in the Start
02:01screen, you'll see an application called Application Deployment. Let's start
02:05this, and I'll explain what it's used for.
02:07You may be working with others on your Windows Phone project, and get a XAP file.
02:12A XAP or X-A-P file is the native app execution file for Windows Phone.
02:17It's like an .exe file in Windows, or an IPA file for iOS.
02:22If you get this file, you can send it to an Emulator, or unlocked device without
02:26having to go through Visual Studio.
02:27In this application, you can select the target, which can include a physical
02:31device, or any of the emulators we have talked about before, including Windows
02:35Phone 7-based emulators.
02:37In this case, I am going to go to PhoneGap Build, where I currently have an app
02:40that's been created for Windows Phone.
02:43I am going to download this file, which is a XAP file. I am just going to save
02:47this to the Desktop. Going to minimize the browser. And, now I can browse for that
02:55particular file on my Desktop.
03:01I am now going to send that to a specific target.
03:04Let's set it to the Emulator we've been using, the WVGA 512 megabytes.
03:09And, then I can click Deploy.
03:12Now, as you can see, it launches the Emulator. But now, instead of having to have
03:15the code inside of Visual Studio, it's able to take this XAP file, and then
03:20install that directly into the Emulator, or a physical device.
03:25Now, one thing, though. It doesn't automatically start the application, so you do
03:29have to click and drag this. And, then when we can go down here, and we would see our
03:33application installed down here at the bottom.
03:36This is helpful if you're working with others that are building native
03:39or cross-platform-based Windows Phone 8 apps, and you need to test them on your device.
03:43Another valuable use of this is if you have an application you want others to test for you.
03:47Providing them with the SDK, and instructions on how to install the application
03:51will allow them to test the app, and send you feedback.
03:54So, as you can see, it's very easy to work with a physical device to test your application.
03:59By registering your phone, you can send your app for real-world testing.
04:02In addition, we covered how you can use the Application Deployment tool to send
04:06any XAP application to an Emulator or Device to help expand your test workflow.
04:11In the next chapter, we'll cover more about the design side of Windows Phone
04:158, and take a look at how to create icons and assets for your app to match the
04:19Windows Phone 8 style guide, and how you can integrate them into your Windows
04:23Phone 8 project.
Collapse this transcript
7. Building Design Assets
Graphics requirements for Windows Phone 8
00:00With the application logic and user interface of our application done, we can
00:04now point our attention towards the packaging and marketing assets of the app.
00:08These include the application icons, Windows Phone Store background images, and
00:12getting them added to our project, and integrated into the application manifest,
00:15which we haven't looked at yet.
00:17In this video, we will walk through some of the design assets that Microsoft
00:20provides you to help you make icons and graphics that will mesh well with the
00:24rest of the icons that are part of the operating system.
00:27You, of course, can make your own, and not follow these guidelines, but I'll walk
00:30you through the materials that are available.
00:32To start, we need to get the design assets from Microsoft.
00:35They are not part of the SDK, and are downloaded separately from the Microsoft
00:38Windows Phone Developer Center website.
00:40So, to get to that website, you want to go to dev.windowsphone.com. Fom here,
00:46click on the Design tab. This will take you to all the different information
00:50that is available for how to create design assets that match the Windows Phone 8 design style.
00:55We can then go into the Library.
00:57Within this, you can go to a whole bunch of different resources.
00:59If you scroll to the bottom, there is a section called Design assets.
01:03We can then go to Design resources to download this file.
01:06Scrolling down on this page, you'll see there is a link here for Icon templates
01:09for Windows Phone 8.
01:11If you click this, you'll download a zip file.
01:13The files that you'll download are in PDF and PSD format, so you'll need Acrobat
01:18and Photoshop to work with them.
01:19I already have downloaded the files here, and have expanded them.
01:22Let's take a look at the AssetTemplateGuide.
01:25Within applications, there are a number of assets that are used for
01:28various parts of the app.
01:29The template guide gives you an overview of all the assets that are part
01:32of Windows phone apps.
01:34Although you might not need all of them for your specific app, it also lets you
01:38know which versions are required for the three various resolutions of Windows
01:41Phone: WVGA, WXGA and 720p.
01:46Let's start with assets that are used within the application.
01:49The first is the Splash Screen.
01:51Not all applications need Splash Screens, but if you have one that has a lengthy
01:55startup time, or needs to connect to remote service before it can start, the
01:59Splash Screen provides a better startup experience for your users, and can break
02:02up any load time that your app may require.
02:04Since our application launches so quickly, we won't need this.
02:08Next is the Panorama Background.
02:10There is an application type called the Panorama App.
02:14If you load the music or photos app on the phone, you'll see what this can look like.
02:18The Panorama Background is the background for these types of apps.
02:21Next are App Bar Buttons.
02:23These are button icons that are used in the app bar that is located at the
02:26bottom of the screen.
02:28The next page of this document goes to the various icons you'll need to make for
02:32your tip calculator.
02:33Let's go through these one at a time.
02:34The icons that you see here are used for the listings and the alphabetical list,
02:39or when pinned to the start screen at various sizes.
02:42If you remember, apps can have a small, medium, or large tile.
02:46The large tile type is optional, and isn't required for your app.
02:49However, you do need to provide the small and medium sizes for your application
02:53to meet Microsoft's design requirements.
02:55Page 6 has the other two assets we'll need to make.
02:58The first is the Catalog Image, which is the icon that will display in the
03:01Windows Store, either on the phone or the store website.
03:04In addition, if your application is promoted or featured on one of the
03:08Windows Store categories, you'll need to have a merchandising image, which is
03:11a large image used to phonetically highlight that section of the store to tie in with your app.
03:16These are the basic file types that we'll need to work with for Windows Phone.
03:20Now, I've already created some assets for our project.
03:22Microsoft's PSDs are annotated to make it easier to follow the
03:26design requirements.
03:27So, let's switch to Photoshop, and take a look.
03:29The application icon is the graphic that is displayed in the alphabetical list
03:33of apps when you swipe the Start screen.
03:35If you want the theme accent color to be used, you need to make sure the icon
03:38has a transparent background.
03:40Now, the icon that I've created here, I brought in from Illustrator.
03:43I'm going to go ahead and hide that, and show the layers here that Microsoft
03:46has prebuilt into these PSDs to give you a little bit more information to get started.
03:50If you see, there's a red layer here called *HIDE* spec ' application.
03:54This shows the padding recommendations for how your icon should be placed within the tile.
03:59As you can see, it's recommended that there is 14 pixel padding around the icon.
04:04There also are three different examples.
04:06They show a phone version, an sms version, and an email version to help get you started.
04:12Now, when you hide these, I also have created my own for our tipped application,
04:17and I'll place that here.
04:18If I show the spec, you'll see that this fits within the 14-pixel padding that
04:23is recommended by Microsoft.
04:25There's also a background layer here. I want to show the theme accent colors,
04:29the background of my graphic here, so I want to make sure this is a transparent icon.
04:34So, by hiding the background, and using the transparency that's already part of
04:37the Photoshop file, now, whether it's orange, or lime, or blue, the white icon
04:42that I've created here will now blend in nicely with whatever theme color the user has chosen.
04:47Let's switch to the Catalog Image.
04:48A Catalog Image is what is shown in the Windows Phone Store.
04:52The store images don't work with the phone theme color, so you should make them
04:56with a specific color, and not use transparency.
04:58You'll notice that these images are larger than others.
05:01That is because these images are used at varying sizes based on different
05:04locations, either on a device, in the store, or on the store website.
05:08Again, it's showing you some recommendations here by showing the icon size. And
05:12then, also there's a background here if you wish to use it.
05:15The next is the medium-sized tile called the FlipCycleTileMedium.
05:20We aren't going to create a large tile for this app.
05:22Large tiles are usually reserved for apps that have tile information to display in them;
05:26for example, rotating images from a photo library, the most recent email on an
05:30inbox, or your next calendar appointment.
05:33Since our app doesn't do that, we don't need to use the large tile format.
05:37Now again, there are hidden layers here that show additional information.
05:40They show recommended padding, and then there are also additional examples here
05:44including music, the local scout application, and the camera.
05:48Let's take a look at the local scout.
05:50You'll see that this goes beyond the recommended padding.
05:53Generally, in Windows Phone, you should always try and constrain within the
05:56height of the padding, but you can overlap from the left to the right to
05:59expand the icon a little bit beyond the recommended padding.
06:02Now, let's go ahead and take a look at the small version, FlipCycleTileSmall.
06:07Again, this is for when we pin our app on the start screen, and we reduce it
06:10to its small format.
06:12Just like the medium version, it also shows the spec information, as well as
06:16various examples, or camera, music, and local scout.
06:20With all these assets, we now need to export them for us to use in our project.
06:24We can't work with the PSDs themselves; we need to export them as a PNG file.
06:28I need to make sure I turn off the layers that are marked as HIDE.
06:32We don't want to use these when we export our file.
06:34So, I'm going to take those off, and then keep the vector logo that I've added in
06:39here from Illustrator, so we can now export this for save to web.
06:42To export, we are going to go to the File menu, and select Save for Web & Devices.
06:46Now, to preserve the transparency, we are going to export this as PNG-24.
06:50I already have that selected here, but if that's not selected, you can open up
06:54the drop-down, and select PNG-24.
06:57Now I click Save, and I select a location where I want to save the file.
07:01You need to repeat this with all the different icons or files you are going to
07:05be using to create your Windows Phone application with.
07:07I usually like to also keep the same name as the original templates.
07:10It helps me to remember what they are, and keep the terms consistent.
07:14Once you've exported all the files, we can now start adding them to our project,
07:17and linking them with the various icon types for the project.
07:20We'll do that in the next video.
Collapse this transcript
Adding design assets to your project
00:00Adding our icons and other artwork to our project is pretty straightforward in
00:03Windows Phone 8, because Visual Studio gives you a visual way to manipulate and
00:07change the design assets in your project.
00:10In this video, we are going to add the Application icon to our project.
00:13We'll do that by adding them to the application manifest through Visual Studio.
00:17In the Solution Explorer, expand the Properties folder, and you'll see a few files.
00:22The WMAppManifest.xml file is where all the information we need to enter is located.
00:28Double-click it to open.
00:29Even though it's an XML file, instead of showing the RAW code, Visual Studio
00:33shows a visual representation of the manifest contents.
00:36We are going to focus on just the icons for now, but we'll go through the other
00:40sections of this in the next chapter.
00:42As you can see, there are areas here for all the icons.
00:45The first is the app icon, which is the small icon shown in the alphabetical list.
00:49To link this to the file, we are going to click on the Ellipse button at
00:52the bottom. And then, we can go to our Exercise Files, and then select the icon asset.
00:58There. Now that's been added to our project, and it's been linked to the App icon.
01:03Next, we need to choose what type of tile we want to have with our application.
01:07Now, although we have an app logo that looks like an icon style, we aren't adding
01:11any other information into it.
01:12So, we are going to use the flip style, and use this as the full size of the
01:16icon space for our logo.
01:18We need to provide two versions, small and large.
01:21Now, let's go ahead and add those in by clicking on the ellipse button. And, we can
01:25select our small icon and our medium icon.
01:29Now, with everything in place, let's go ahead and launch the Emulator, and see how this looks.
01:33So, Visual Studio automatically launches the application.
01:36So, let's go ahead and Stop Debugging, but then go back to the Emulator.
01:40The application is still installed.
01:42So, let's go ahead and swipe over to see the list of applications, and then
01:45scroll down to the bottom.
01:47You will see that Tipd has given the app icon that we defined earlier, and if
01:51I hold and pin to start, you will see that the medium-sized icon that we
01:55created is also then used.
01:57Now, just like on a physical device, I can click and hold, make this smaller,
02:02which then uses the smaller version of the icon.
02:05Now, we can also personalize this, and actually use a different accent color in the Emulator.
02:10I am going to swipe over, and access the Settings, and then change the theme.
02:15Let's change it to blue, and then press Start.
02:18Now, if I scroll down to the bottom, our icon is now using the new theme color that
02:22we used, and we didn't have to provide a different icon for it.
02:25As you can see, our App icon is now visible in the application list, and also now
02:29when it's pinned to the Start screen.
02:31Now, since we aren't supporting the large tile size, the interface won't allow us
02:34to use the wide version of the Emulator.
02:37If you test this on an actual phone, you'll see exactly the same thing, just
02:40turned to the accent color that you choose.
02:43In the next chapter, we'll go through the necessary step to get your app in the store.
02:47This will involve creating a Windows Phone Developer account, putting some
02:49additional information in your application manifest, and submitting to the store,
02:53and waiting for it to get approved.
02:55We'll start all of this in the next video.
Collapse this transcript
8. Deploying to the Windows Phone Store
Creating a Windows Phone Developer account
00:00In order to submit your application to Microsoft to distribute in the Windows
00:03Phone Store, you need to create a Developer account with Microsoft.
00:07When you create a Windows Phone Developer account, you'll pay Microsoft an
00:10annual subscription, and have the ability to submit your application for review
00:14by the Microsoft App team.
00:15In addition, you will get information and statistics on your application
00:18downloads, sales, crash counts, and other information that will be helpful if you
00:23are going into App development as a side or primary business.
00:26Creation of a Developer account requires a Microsoft Account ID.
00:29The ID can be any email that you currently have, or you can create a new one with Microsoft.
00:34To get started, go to dev.windowsphone.com/join.
00:40You will get to the page that I currently have displayed here.
00:43Go ahead and click on Join Now, and then I'll ask you to get started.
00:47If you currently already are logged in through a service like outlook.com, it
00:50might automatically sign you in.
00:52In this case, I'm able to now get started on registering for my Developer account.
00:56I first need to provide information about what country of residence is my business;
00:59in this case, I'll pick the United States.
01:02If you're working as a company, you can select Company, or if you are doing this
01:05as an individual, you can select individual.
01:08You also need to agree to the Windows Phone Store Application
01:10Provider Agreement.
01:12Click on the link to open and display it here, and once you've read it, check the
01:15checkbox, and then click next.
01:17You then need to provide contact information to add to your account.
01:21In this case, I'll go ahead and enter in my information here.
01:24You need to enter in a Publisher name here.
01:27Click the Check availability button to make sure that this isn't used by another developer.
01:31Now click Next.
01:32You then have the option of purchasing your subscription, paying for it as an
01:36annual subscription. If you are currently a student, enrolled with a DreamSpark
01:40account, you can click that, or if you have a promotional code, provided by a
01:43third party or from Microsoft, you can select that, and enter the code.
01:47Now, you need to provide your payment, either through a credit card or a PayPal
01:51account, provide your billing address, and then you would click Next.
01:56Once you have submitted your payment, and your account is created, you can then log
01:59into your account, and access the Dashboard.
02:01The Dashboard is your central repository for all the information about your
02:04account and your apps.
02:06When you create your account, and after you have provided all of your personal
02:09information, there are a couple additional steps you need to take, if you wish
02:12to get paid for the apps that you sell in the Windows Phone Store.
02:15In the Dashboard, go to your account, and you'll see that there are two sections
02:20down here in the middle: Tax profile and Payment account.
02:23By clicking on the Tax profile, Edit, or Create button, you will need to fill out
02:27a US Department of Treasury Tax form that indicates that you will potentially be
02:30receiving app sale payments from Microsoft that will not have taxes withheld.
02:35Microsoft will report these payments to the IRS, which you'll need to include
02:38when you file your taxes.
02:40In addition, if you're selling your application, you also will need to provide a
02:43method of receiving payments from Microsoft.
02:45At the time of this recording, Microsoft supported a checking account and PayPal.
02:50Once you set up your account, you are ready to go.
02:52One important note is that a Windows Phone Developer account is separate from
02:55a Windows 8 account.
02:56The two programs are different from each other, and you need to apply, and pay for
03:00each one separately.
03:01Now that the Developer account is created, we can go back to the application,
03:04and configure the last pieces of our application manifest, and get ready to
03:08submit our app.
Collapse this transcript
Configuring the application manifest
00:00Before we can package and submit our app, there are few things we need to
00:03complete in the application manifest within Visual Studio.
00:06If you're a member, the Application Manifest is where we added our
00:09application icons to the app.
00:11We didn't look at the other tabs, but we'll do that in this video, and define
00:14some of the unique parameters that you'll need to work with in your own apps
00:18before you send them to Microsoft.
00:19If you still have the project open from the previous chapter, you can
00:22keep working with it. If not,
00:24open the project from the downloaded Exercise Files.
00:27Since we need to work with the AppManifest file, expand the Properties folder in
00:31the Solution Explorer, and double-click on WMAppManifest.xml.
00:36Here we can see the app icons that we attached to our project in the previous chapter.
00:40One other field we should populate is the application description;
00:43just provide a simple description in here about what our app does.
00:46As a general hint, you may find it helpful to keep app descriptions and other
00:50descriptive text in a Word document, or in some other separate file.
00:53It makes it easier to update them as you add new versions, and keep them
00:57consistent if you're using them in multiple places.
00:59In addition, not all areas where you enter descriptions will have spell-checking support.
01:03Next, we need to define the capabilities of the application.
01:06When you submit your app, you need to define all the hardware and network
01:10capabilities of the device.
01:11This is used to notify the user before they purchase or use the app that the app
01:15requires specific capabilities on the device.
01:19For instance, it may require access to the Internet, access to media services,
01:23access to your user account, file access, or other capabilities.
01:27Some users that are sensitive to access to their hardware, may not permit the
01:30use of these certain capabilities.
01:32It also provides extra security by notifying what an application can do.
01:36If you build an app, and not specifically request access to a capability, and then
01:40try to access it, the app will be denied that access.
01:43In fact, an app may not successfully compile if you violate your defined
01:47capabilities rule, or it could be rejected during the app review cycle.
01:50Since our app doesn't require access to any unique hardware, we can uncheck all
01:54of the capabilities.
01:56The Requirements tab continues the list of allowable services that your app can work with.
02:00In this case, it is focused on hardware capabilities like cameras, near field
02:03communications, the compass, and motion sensors.
02:07Again, since our app doesn't require any of these, we can leave them unchecked.
02:10Finally, we have the Packaging tab.
02:12When we create our app and build the package or zap file, within it is metadata
02:16about the author, version number, and other information of the app.
02:20Some of the information on this tab is automatically generated.
02:23So, unless you have a specific reason to do so, keep the Product ID and
02:27Publisher ID unchanged.
02:29These are the unique identifiers for your Application and Developer account
02:32that will link everything together in the distribution and reporting system at Microsoft.
02:36Let's go ahead and finish the rest of the information on this page.
02:39I'll put in my name as the Author. Publisher, I'll also make me. Since this is the
02:43first version of the app, we'll leave it at 1. 0.0.0. And, this is the unique Product ID
02:48that's been assigned to my app, as well as my personal Publisher ID.
02:52Below, also are the default languages for the app.
02:54In this case, United States English, as well as other supported languages that
02:58the app can work with.
02:59With this tab finished, we are ready to build our release version, and begin
03:02the submission process.
03:04We'll do that in the next movie.
Collapse this transcript
Packaging and uploading
00:00We are now at the last step.
00:02Congratulations on getting to this point.
00:04What we have to do now, though, is to build our project as a release version,
00:07get screenshots of our app, to add to the Windows Phone Store, and submit the app to Microsoft.
00:12So, let's go ahead and get started.
00:13When we have been building our app before, we have been creating a debug version
00:17that allows for more integration with the Visual Studio environment.
00:20Now that we are ready to release, we need to use the Release version in the
00:23Compiler to build the final version for us to submit to Microsoft.
00:27Let's switch to Visual Studio, and get started.
00:30To make this adjustment, we need to change the drop-down that says Debug to Release.
00:35With that made, we can now get started with the next step, which is to get
00:38screenshots of our app to go along with the submission in the store.
00:41To get started with that, we need to create screenshots for all the resolutions
00:44that are supported by our app.
00:46In this case, we have three: WVGA, WXGA, and 720P.
00:51Let's pick the WVGA Emulator, and launch the app from there.
00:56Now, when you start the app in the Emulator, you will see a bunch of numbers
00:59written along the side of the phone.
01:01Since we don't want these, we should stop debugging, and launch the app outside
01:04the integration with Visual Studio.
01:06So, I'll click Stop Debugging. I'm going to switch back to the Emulator. And, now I can
01:11swipe to the application list, and select the app.
01:14The control bar here on the right, I can then expand out, and select
01:17the Screenshot tab.
01:19Here, I can then create a capture, and I can save this to my computer.
01:23I am going to create a folder called WVGA, and save it in here. appStartup.
01:29Now you have to have at least one screenshot for each of the resolutions, which
01:33means you'll end up with three:
01:35one for WVGA, WXGA, and 720P.
01:39It's best to have multiple screenshots to show all the different states and
01:43capabilities of what your application can do.
01:45Once you have all the screenshots, it's now time to submit.
01:48What we are going to do now is we are going to close the Emulator, and we are
01:51going to go back to the Visual Studio.
01:53I am then going to go into BUILD, and Build Solution.
01:56This is now going to be creating a release version of this.
01:59I am going to then go to BUILD, and Deploy Solution.
02:02If you look, this line here says that our XAP file has been created, and has succeeded.
02:08With the XAP file created, we can now go back to the Dashboard of Windows
02:11Phone Development Center.
02:13Here we are then, going to click on SUBMIT APP.
02:15Submitting an app is a step-by-step process.
02:18We first need to provide App information, then upload and describe the XAP
02:22files that are part of our project. Let's get started with step one, providing the app info.
02:27Here we need to provide some information around the application.
02:30I am going to create an alias for our app, which I am just going to name the
02:33same as our App name, and then you need to provide some categorization for how
02:37the app would be organized within the Windows store.
02:40If I open up the category, this would be a tools and productivity application.
02:43Some categories have subcategories, but in this case, there isn't any.
02:47So, we can leave that one alone.
02:49If you wish to sell your application, you can pick a price point within
02:52this drop-down list.
02:53Your rate is all the way from $.99 to $499.99.
02:58We are going to keep this app free.
03:00Under Market distribution, there are of couple options here.
03:03You can distribute to all available markets at the base price tier, or distribute
03:06to all markets except those with stricter content rules.
03:09It defaults to the second one, and I am going to leave that one alone.
03:12There are additional options here to talk about distribution
03:15channels, publishing and other things, but we don't need that for our
03:18particular application.
03:20I am then going to click Save.
03:22The next step is to upload and describe your XAPs.
03:24Here, we need to browse for and upload the XAP file that we created in Visual Studio.
03:30You will see that there is a Bin folder. Double-click the Release folder, and
03:33then we see our XAP file listed here.
03:35I could then open this. It's then going to take the XAP file, and upload that to Microsoft.
03:40Now the XAP file already contains some information inside of it, including the
03:44version number, capabilities, file size, language, supported operating systems.
03:49So these things are already provided for us. In addition, it provides a little
03:53bit of information around the language details, but one of the things we do have to
03:57provide, though, is the description for the store.
03:59So, in this case, I am going to re-enter what we had before. And then, I have the
04:03option of providing some specific keywords that if people use to search, would
04:06bring up my application.
04:08I am going to use tip, calculator, bill, gratuity, and dining.
04:14Next, we have the Upload images section.
04:16Here, we need to provide two specific files, our app icon and the required
04:22screenshot for each one of the resolutions, in this case, WVGA, WXGA, and 720P.
04:28To add these assets, just click on the plus (+) icon, and select the file that
04:32matches to that particular asset.
04:36Once you have uploaded all the required assets, you can then save, and it
04:40will submit the app.
04:41With the app submitted, we now need to wait from Microsoft to approve the app.
04:45Microsoft testers will thoroughly review the app, and test it in various scenarios.
04:49The process can take up to a week.
04:51If your app passes, you will get an email that says, "Your app is all approved,
04:54and is in the App Store."
04:56If it fails, you will get a detailed report of what part of the submission
04:59guidelines the app failed, and in some cases, you will get steps they used to
05:02reproduce the error.
05:04You can then go back, fix the errors, and resubmit the app to Microsoft.
05:07Once you have an approved app, you can then see it live in the Windows Phone store.
05:11We'll do that in the next movie.
Collapse this transcript
Seeing your app in the Windows Phone Store
00:00Now that our app is in the app store, we can see it live.
00:03If you get your approval email, it may take a full day for the store to index,
00:07and have the app searchable.
00:08So, if it isn't there immediately, give it a little bit more time.
00:11There are two places we can view our app.
00:13The first is in the store on the device.
00:15Since the Emulator is a full-featured Windows Phone, you can see it there.
00:19So, I can go into the Windows Store, and then search for my app.
00:25As you can see, it uses the icon that we created earlier, and if I go into this,
00:29it shows the icon any reviews that you might have received for the app, and
00:33also the screenshots.
00:36It shows the screenshots that are matching the phone that you are actually
00:38looking at the store on.
00:40So, if you are using a 720P phone, it will show the 720P screenshots.
00:44You can also view your app on the online store using a web browser.
00:47If I go back to the Developer center, and I go to the Dashboard, and I access my
00:51specific application, if I go to the Details tab, it will then give me all those
00:56additional details to the location of where our app is on the store.
01:00If I click this link, it will take me directly to the app.
01:03As you can see, it also shows the same product image, screenshots, and all the
01:07other information we provided when we created our app.
01:10With that, we've now completed our app, and it's now in the store.
01:13From this point, if you decide to add new features or enhancements to your app,
01:17you can work on them, and then submit updated versions to Microsoft.
01:20Remember, if you're updating an existing app, you don't want to create a new app
01:24submission, but update the existing app. Otherwise, you might have two versions
01:27of the same app in the store, which could lead to confusion.
01:30In the next video, we'll wrap everything up, and I'll give you some pointers
01:33on where to go next.
Collapse this transcript
Conclusion
Next steps
00:00Windows Phone provides a unique take on the smartphone, the unique life tiles,
00:04the bold and simple design of the hardware and user interface. And, the
00:08integration of the services like Xbox Live, SkyDrive, and Office make Windows
00:12Phone a great platform.
00:13In addition, authoring for the platform is very straightforward and easy to do,
00:17if you have experience working with C#, Visual Basic, or C++.
00:20But where do you go from here?
00:22In this course, we cover the basics of getting started with development
00:25for Windows Phone 8.
00:26To go further, a great resource is the MSDN website and the Windows
00:30Phone Developer Center.
00:31These sites have extensive sample applications, code snippets, and helpful forums
00:35to ask questions, and communicate with other developers.
00:38In addition, if you're new to programming, I would recommend that you find out
00:41more about C#, Visual Basic, or C++, which are the main languages for building
00:46native apps for Windows Phone.
00:47As you work more with Visual Studio, there are resources available on some of
00:51the more advanced time-saving, productivity features of Visual Studio 2012 that
00:55can make your development for Windows Phone easier.
00:57Finally, if you haven't already, you may want to consider looking at
01:00developing for Windows 8.
01:02Windows Store applications for Windows 8 use the same basic technologies of XAML
01:06and C# that we have used in this course.
01:08And, in some cases, you can share code across Windows Phone 8 and Windows 8 projects.
01:13So with that, thank you, for completing this course.
01:15I hope it has been helpful and informative.
01:17If you have any feedback, please feel free to use the Feedback Form on the
01:20course page to send your feedback on your experiences with this course.
01:23Thanks again, and have fun developing apps for Windows Phone 8.
Collapse this transcript


Suggested courses to watch next:

Foundations of Programming: Fundamentals (4h 47m)
Simon Allardice

C# Essential Training (6h 44m)
Joe Marini


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,069 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,024 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.

preview image of new course page

Try our new course pages

Explore our redesigned course pages, and tell us about your experience.

If you want to switch back to the old view, change your site preferences from the my account menu.

Try the new pages No, thanks

site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

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.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

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

   
submit Lightbox submit clicked