SlideShare a Scribd company logo
An Introduction to
Silverlight
Dave Bost
dave.bost@microsoft.com
http://davebost.com | @davebost
Topics
   The Metro design style
   Silverlight Components
   Creating a Silverlight Application
   Silverlight and XAML
   Introduction to Silverlight Layout
   Components and Events
   Silverlight Project Templates
   ApplicationBar
   Page Navigation

2   Windows Phone
Windows Phone
Windows Phone and Metro

 To make life easier for us the Metro
  style is “baked in” to the Windows
  developer tools
 The default appearance, behaviour
  and fonts of the user elements all
  match the style
 If you want to find out more about
  Metro on phone you can read the
  “User Experience Design
  Guidelines”
http://msdn.microsoft.com
4   Windows Phone
Tools for the job : Graphical
Design separates the
 Great design
  graphical design aspects from
  the programming
       The designer works on the
         look and feel of the
         application
       The programmer
         implements the required
         behaviours
 Silverlight is designed to support
  this
 A Silverlight designer can use
  the “Expression Blend” to specify
  the appearance of the user
5 interface
   Windows Phone                       5
Metro Templates and
Components
 Visual Studio
  provides a set
  of Metro
  project
  templates
 Each of them
  maps onto a
  particular style
  of application


6   Windows Phone     6
Application Types and Templates




 The three application types provide quite different user experiences
 Select the one that you feel is the most appropriate


7   Windows Phone                              7
Silverlight display elements

   Application title
   Page title
   First number
   Plus text
   Second number
   Equals button
   Result text




8   Windows Phone       8
Silverlight element class hierarchy
                                                         FrameworkElement




 The Silverlight class hierarchy is quite
  complex
                                             TextBlock             Control
 Everything is based on the
  FrameworkElement class which
  contains the fundamental properties
                                                         TextBox             ContentControl
  of all elements
 You can derive your own
  components if you wish                                                      ButtonBase




                                                                                Button




9   Windows Phone                                    9
Elements in AddingMachine

 The adding machine actually contains three different types of Silverlight
  display element
 TextBox
     Used to receive user input from the keyboard
 TextBlock
     Used to display messages to the user
 Button
     Used to cause events in the application




1   Windows Phone                              10
0
Elements and XAML
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBox Height="72" HorizontalAlignment="Left"
              Margin="8,19,0,0" Name="firstNumberTextBox"
              Text="0" VerticalAlignment="Top" Width="460"
              TextAlignment="Center" />
     . . .
        <Button Content="equals" Height="72"
                HorizontalAlignment="Left"
                Margin="158,275,0,0" Name="equalsButton"
                VerticalAlignment="Top" Width="160"
                Click="equalsButton_Click" />
     . . .
    </Grid>




   XAML is the markup language that describes the Silverlight UI
    components

1    Windows Phone                             11
1
Grid container element
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBox Height="72" HorizontalAlignment="Left"
              Margin="8,19,0,0" Name="firstNumberTextBox"
              Text="0" VerticalAlignment="Top" Width="460"
              TextAlignment="Center" />
     . . .
        <Button Content="equals" Height="72"
                HorizontalAlignment="Left"
                Margin="158,275,0,0" Name="equalsButton"
                VerticalAlignment="Top" Width="160"
                Click="equalsButton_Click" />
     . . .
    </Grid>




   Grid is a container into which you can position display elements

1    Windows Phone                              12
2
TextBox element
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBox Height="72" HorizontalAlignment="Left"
              Margin="8,19,0,0" Name="firstNumberTextBox"
              Text="0" VerticalAlignment="Top" Width="460"
              TextAlignment="Center" />
     . . .
        <Button Content="equals" Height="72"
                HorizontalAlignment="Left"
                Margin="158,275,0,0" Name="equalsButton"
                VerticalAlignment="Top" Width="160"
                Click="equalsButton_Click" />
     . . .
    </Grid>



 TextBox is used for text entry
 TextBlock can be used for text display

1    Windows Phone                           13
3
Button element
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBox Height="72" HorizontalAlignment="Left"
              Margin="8,19,0,0" Name="firstNumberTextBox"
              Text="0" VerticalAlignment="Top" Width="460"
              TextAlignment="Center" />
     . . .
        <Button Content="equals" Height="72"
                HorizontalAlignment="Left"
                Margin="158,275,0,0" Name="equalsButton"
                VerticalAlignment="Top" Width="160"
                Click="equalsButton_Click" />
     . . .
    </Grid>




   Button is used for user actions and generates events when activated

1    Windows Phone                            14
4
Button element
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <TextBox Height="72" HorizontalAlignment="Left"
              Margin="8,19,0,0" Name="firstNumberTextBox"
              Text="0" VerticalAlignment="Top" Width="460"
              TextAlignment="Center" />
     . . .
        <Button Content="equals" Height="72"
                HorizontalAlignment="Left"
                Margin="158,275,0,0" Name="equalsButton"
                VerticalAlignment="Top" Width="160"
                Click="equalsButton_Click" />
     . . .
    </Grid>




   Click is the button clicked event which is bound to the method
    specified

1    Windows Phone                             15
5
Button click event handler
    private void equalsButton_Click(object sender, RoutedEventArgs e)
    {
        float v1 = float.Parse(firstNumberTextBox.Text);
        float v2 = float.Parse(secondNumberTextBox.Text);

            float result = v1 + v2;

            resultTextBlock.Text = result.ToString();
    }




   The event hander for the button takes the values out of the textboxes,
    parses them and then calculates and displays the result


1       Windows Phone                            16
6
Demo

Demo 1: The
Silverlight
Adding Machine
                 17
Best Practice: Keyboard use

 It is best if the user can still press
  the equals button when the
  keyboard is displayed
 This means the equals button
  should be moved up the screen




1   Windows Phone                          18
8
Selecting Orientations
    SupportedOrientations="Portrait"


    SupportedOrientations="PortraitOrLandscape"

     A XAML property for the phone application page lets you select the
      orientation options available
     Your application can bind to an event which is fired when the orientation
      changes




1       Windows Phone                             19
9
Using a StackPanel
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
       <StackPanel>
          <TextBox Height="72" HorizontalAlignment="Center" .../>
          <TextBlock Height="56" HorizontalAlignment="Center" .../>
          <TextBox Height="72" HorizontalAlignment="Center" .../>
          <Button Content="equals" Height="72" ...>
          <TextBlock Height="46" HorizontalAlignment="Center" .../>
       </StackPanel>
    </Grid>




   To automatically handle orientation change we can use a StackPanel
    container that will stack the display components

2    Windows Phone                           20
0
Demo


Demo 2: Orientation Handling

                               21
Handling errors
    try
    {
      v1 = float.Parse(firstNumberTextBox.Text);
      v2 = float.Parse(secondNumberTextBox.Text);
    }
    catch
    {
        MessageBox.Show("Invalid number");
        return;
    }




 A program can catch errors as on the desktop
 There is also a MessageBox mechanism as well



2    Windows Phone                            22
2
Configuring the input scope
    <TextBox InputScope="Number" ...


 If all you want from the user is a number it is
  dangerous to allow them to enter text as well
 You can add to the XAML to specify that the
  keyboard only accepts numbers




2    Windows Phone                              23
3
Demo

Demo 3: Complete
Adding
Machine
                   24
ApplicationBar
Application Chrome
System Tray and Application Bar
 System Tray
     System owned indicator area that
      displays system-level status information
     Apps can show/hide
     Microsoft.Phone.Shell.SystemTray.IsVisib
      le = false;
 Application Bar
     Area where applications can display
      buttons for the most common tasks
     Can display pop-up menu for less
      common tasks

2   Windows Phone                           26
6
Application Bar




2
7
Application Bar in Xaml
<phone:PhoneApplicationPage
  x:Class=“MyApp.MainPage”
  … >

    <phone:PhoneApplicationPage.ApplicationBar>
      <shell:ApplicationBar x:Name="AppBar" IsMenuEnabled="True">
          <shell:ApplicationBar.Buttons>
              <shell:ApplicationBarIconButton x:Name="NewContactButton"
                     IconUri="Images/appbar.new.rest.png" Text="New"
                     Click="NewContactButton_Click"/>
              <shell:ApplicationBarIconButton x:Name="SearchButton"
                     IconUri="Images/appbar.feature.search.rest.png"
                     Text="Find" Click="SearchButton_Click"/>
          </shell:ApplicationBar.Buttons>
          <shell:ApplicationBar.MenuItems>
              <shell:ApplicationBarMenuItem x:Name="GenerateMenuItem"
                    Text="Generate Data" Click="GenerateMenuItem_Click" />
              <shell:ApplicationBarMenuItem x:Name="ClearMenuItem"
                     Text="Clear Data" Click="ClearMenuItem_Click" />
          </shell:ApplicationBar.MenuItems>
      </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>



2     Windows Phone                   28
8
App Bar & Landscape




2   Windows Phone
9
Page Navigation
Frame and Page
 Frame
     Top-level container control
     PhoneApplicationFrame class
     Contains the page control and
      system elements such as
      system tray and application bar
 Page
     Fills the entire content region of
      the frame
     PhoneApplicationPage-derived
      class
     Contains a title
     Optionally surfaces its own
      application bar
3   Windows Phone
1
Page Navigation
    Silverlight on Windows Phone uses
     a Page-based navigation model
          Similar to web page model
          Each page identified by a URI
          Each page is essentially stateless

    private void hyperlinkButton1_Click(
           object sender, RoutedEventArgs e)
    {
      NavigationService.Navigate(
         new Uri("/SecondPage.xaml",
                UriKind.RelativeOrAbsolute)
      );
    }



3    Windows Phone
2
Navigating Back
   Application can provide controls to
    navigate
    back to preceding page
    private void button1_Click(
      object sender, RoutedEventArgs e)
    {
        NavigationService.GoBack();
    }


   The hardware Back key will also
    navigate back to preceding page
         No code required – built-in behaviour




3   Windows Phone
3
Demo


ApplicationBar, Page Navigation and
Pivot Control
                                      34
Review

   Windows Phone applications use Silverlight to express the design of
    their user interface
         The design is expressed in a XAML text file that identifies and
           configures display elements
         Elements can also be manipulated as code objects
   There are a set of Silverlight templates for applications and elements
    based on the Metro design
   You can create multiple Silverlight pages and add them to your project
   Navigation to pages is performed on the basis of uri (Uniform Resource
    Indicator) values
   The back button normally navigates back to the source page, but this
    can be overridden

3
    The uri can contain simple text messages
     Windows Phone                                 35
5
   Pages can share larger objects in the App.xaml page
Bonus
  (and really good to know)
Silverlight Toolkit for Windows
Phone the Microsoft Silverlight team
A product of
 The Silverlight Toolkit adds tons of additional controls „out of band‟ from
  the official product control set
 Includes full open source code, samples, documentation, and design-
  time support for controls
 Refresh every 3 months or so
      Bug fixes
      New controls
 http://silverlight.codeplex.com




3
7
NuGet

 Package management system for .NET
 Simplifies incorporating 3rd party libraries
 Developer focused
 Free, open source


 Install NuGet using the Visual Studio Extension
  Manager
 Use NuGet to add libraries such as the
  Silverlight Toolkit to your project




3   Windows Phone
8
Q&A

More Related Content

What's hot

06 win forms
06 win forms06 win forms
06 win forms
mrjw
 
Spf chapter10 events
Spf chapter10 eventsSpf chapter10 events
Spf chapter10 events
Hock Leng PUAH
 
Creating a quiz using visual basic 6
Creating a quiz using visual basic 6Creating a quiz using visual basic 6
Creating a quiz using visual basic 6
Ella Marie Wico
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1
Bhushan Mulmule
 
Windows xp unit a
Windows xp unit aWindows xp unit a
Windows xp unit aDo Sincere
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
Ranjuma Shubhangi
 
Controls events
Controls eventsControls events
Controls events
Dalwin INDIA
 
Buttons In .net Visual Basic
Buttons In .net Visual BasicButtons In .net Visual Basic
Buttons In .net Visual Basic
manish maurya
 
IDS FortuneNext 6i Property Management: Hot keys and keyboard short cuts
IDS FortuneNext 6i Property Management: Hot keys and keyboard short cutsIDS FortuneNext 6i Property Management: Hot keys and keyboard short cuts
IDS FortuneNext 6i Property Management: Hot keys and keyboard short cuts
Institute of Hotel Management, Hajipur, Patna, Bihar.
 
Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)
iFour Technolab Pvt. Ltd.
 
Creating a dot netnuke
Creating a dot netnukeCreating a dot netnuke
Creating a dot netnuke
Nguyễn Anh
 
Computer homework
Computer homeworkComputer homework
Computer homework
adarsh-kaul
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
Ankit Dubey
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
marwaeng
 
130297267 transformations
130297267 transformations130297267 transformations
130297267 transformations
Sunil Pandey
 
INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS
Prof Ansari
 

What's hot (18)

06 win forms
06 win forms06 win forms
06 win forms
 
Spf chapter10 events
Spf chapter10 eventsSpf chapter10 events
Spf chapter10 events
 
12 gui concepts 1
12 gui concepts 112 gui concepts 1
12 gui concepts 1
 
Creating a quiz using visual basic 6
Creating a quiz using visual basic 6Creating a quiz using visual basic 6
Creating a quiz using visual basic 6
 
Tutorials2
Tutorials2Tutorials2
Tutorials2
 
Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1Windows Forms For Beginners Part - 1
Windows Forms For Beginners Part - 1
 
Windows xp unit a
Windows xp unit aWindows xp unit a
Windows xp unit a
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Controls events
Controls eventsControls events
Controls events
 
Buttons In .net Visual Basic
Buttons In .net Visual BasicButtons In .net Visual Basic
Buttons In .net Visual Basic
 
IDS FortuneNext 6i Property Management: Hot keys and keyboard short cuts
IDS FortuneNext 6i Property Management: Hot keys and keyboard short cutsIDS FortuneNext 6i Property Management: Hot keys and keyboard short cuts
IDS FortuneNext 6i Property Management: Hot keys and keyboard short cuts
 
Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)
 
Creating a dot netnuke
Creating a dot netnukeCreating a dot netnuke
Creating a dot netnuke
 
Computer homework
Computer homeworkComputer homework
Computer homework
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
130297267 transformations
130297267 transformations130297267 transformations
130297267 transformations
 
INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS
 

Similar to Introduction to Silverlight for Windows Phone

02 getting started building windows runtime apps
02   getting started building windows runtime apps02   getting started building windows runtime apps
02 getting started building windows runtime apps
WindowsPhoneRocks
 
Windows 8 app bar and live tiles
Windows 8 app bar and live tilesWindows 8 app bar and live tiles
Windows 8 app bar and live tilesAmr Abulnaga
 
Designing XAML apps using Blend for Visual Studio 2013
Designing XAML apps using Blend for Visual Studio 2013Designing XAML apps using Blend for Visual Studio 2013
Designing XAML apps using Blend for Visual Studio 2013
Fons Sonnemans
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발
영욱 김
 
Unique features of windows 8
Unique features of windows 8Unique features of windows 8
Unique features of windows 8
FITC
 
05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation
Nguyen Tuan
 
Android Button
Android ButtonAndroid Button
Android Button
bhavin joshi
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind
 
XAML and WPF - Dinko Jakovljević
XAML and WPF - Dinko JakovljevićXAML and WPF - Dinko Jakovljević
XAML and WPF - Dinko Jakovljević
Software StartUp Academy Osijek
 
Csphtp1 12
Csphtp1 12Csphtp1 12
Csphtp1 12
HUST
 
Session 5#
Session 5#Session 5#
Session 5#
Mohamed Samir
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0Aarti P
 
Sencha touch
Sencha touchSencha touch
Sencha touch
Akshay Prabhu
 
Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWTbackdoor
 
Ajax control tool kit
Ajax control tool kitAjax control tool kit
Ajax control tool kitVidhi Patel
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
Siva Kumar reddy Vasipally
 

Similar to Introduction to Silverlight for Windows Phone (20)

02 getting started building windows runtime apps
02   getting started building windows runtime apps02   getting started building windows runtime apps
02 getting started building windows runtime apps
 
Windows 8 app bar and live tiles
Windows 8 app bar and live tilesWindows 8 app bar and live tiles
Windows 8 app bar and live tiles
 
Android
AndroidAndroid
Android
 
Designing XAML apps using Blend for Visual Studio 2013
Designing XAML apps using Blend for Visual Studio 2013Designing XAML apps using Blend for Visual Studio 2013
Designing XAML apps using Blend for Visual Studio 2013
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
4.C#
4.C#4.C#
4.C#
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발
 
Unique features of windows 8
Unique features of windows 8Unique features of windows 8
Unique features of windows 8
 
05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation
 
Android Button
Android ButtonAndroid Button
Android Button
 
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
netmind - Primer Contacto con el Desarrollo de Aplicaciones para Windows 8
 
XAML and WPF - Dinko Jakovljević
XAML and WPF - Dinko JakovljevićXAML and WPF - Dinko Jakovljević
XAML and WPF - Dinko Jakovljević
 
Csphtp1 12
Csphtp1 12Csphtp1 12
Csphtp1 12
 
Session 5#
Session 5#Session 5#
Session 5#
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Sencha touch
Sencha touchSencha touch
Sencha touch
 
Vb%20 tutorial
Vb%20 tutorialVb%20 tutorial
Vb%20 tutorial
 
Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
 
Ajax control tool kit
Ajax control tool kitAjax control tool kit
Ajax control tool kit
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 

More from Dave Bost

Developing for Windows Phone 8 and Windows 8
Developing for Windows Phone 8 and Windows 8Developing for Windows Phone 8 and Windows 8
Developing for Windows Phone 8 and Windows 8Dave Bost
 
Introducing Windows Phone 8 Development
Introducing Windows Phone 8 DevelopmentIntroducing Windows Phone 8 Development
Introducing Windows Phone 8 DevelopmentDave Bost
 
Monetizing Your Windows Phone App
Monetizing Your Windows Phone AppMonetizing Your Windows Phone App
Monetizing Your Windows Phone App
Dave Bost
 
Live Tiles and Notifications in Windows Phone
Live Tiles and Notifications in Windows PhoneLive Tiles and Notifications in Windows Phone
Live Tiles and Notifications in Windows Phone
Dave Bost
 
Windows Phone Application Platform
Windows Phone Application PlatformWindows Phone Application Platform
Windows Phone Application Platform
Dave Bost
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
Dave Bost
 
Microsoft+PHP: Make Web Not War
Microsoft+PHP: Make Web Not WarMicrosoft+PHP: Make Web Not War
Microsoft+PHP: Make Web Not WarDave Bost
 
The Windows Azure Platform (MSDN Events Series)
The Windows Azure Platform (MSDN Events Series)The Windows Azure Platform (MSDN Events Series)
The Windows Azure Platform (MSDN Events Series)
Dave Bost
 
Azure - The Next Frontier
Azure - The Next FrontierAzure - The Next Frontier
Azure - The Next Frontier
Dave Bost
 
Internet Explorer 8 Developer Overview
Internet Explorer 8 Developer OverviewInternet Explorer 8 Developer Overview
Internet Explorer 8 Developer Overview
Dave Bost
 
Windows 7 Developer Overview
Windows 7 Developer OverviewWindows 7 Developer Overview
Windows 7 Developer Overview
Dave Bost
 
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
Dave Bost
 
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
Dave Bost
 
Silverlight 2
Silverlight 2Silverlight 2
Silverlight 2
Dave Bost
 
Building Applications for SQL Server 2008
Building Applications for SQL Server 2008Building Applications for SQL Server 2008
Building Applications for SQL Server 2008
Dave Bost
 
A Lap Around Windows Azure
A Lap Around Windows AzureA Lap Around Windows Azure
A Lap Around Windows Azure
Dave Bost
 
WPF Unleashed: Building Application with Visual Studio 2008 SP1
WPF Unleashed: Building Application with Visual Studio 2008 SP1WPF Unleashed: Building Application with Visual Studio 2008 SP1
WPF Unleashed: Building Application with Visual Studio 2008 SP1Dave Bost
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedDave Bost
 
A Tour of CodePlex
A Tour of CodePlexA Tour of CodePlex
A Tour of CodePlex
Dave Bost
 
WPF Applications, It's all about XAML these days
WPF Applications, It's all about XAML these daysWPF Applications, It's all about XAML these days
WPF Applications, It's all about XAML these days
Dave Bost
 

More from Dave Bost (20)

Developing for Windows Phone 8 and Windows 8
Developing for Windows Phone 8 and Windows 8Developing for Windows Phone 8 and Windows 8
Developing for Windows Phone 8 and Windows 8
 
Introducing Windows Phone 8 Development
Introducing Windows Phone 8 DevelopmentIntroducing Windows Phone 8 Development
Introducing Windows Phone 8 Development
 
Monetizing Your Windows Phone App
Monetizing Your Windows Phone AppMonetizing Your Windows Phone App
Monetizing Your Windows Phone App
 
Live Tiles and Notifications in Windows Phone
Live Tiles and Notifications in Windows PhoneLive Tiles and Notifications in Windows Phone
Live Tiles and Notifications in Windows Phone
 
Windows Phone Application Platform
Windows Phone Application PlatformWindows Phone Application Platform
Windows Phone Application Platform
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
Microsoft+PHP: Make Web Not War
Microsoft+PHP: Make Web Not WarMicrosoft+PHP: Make Web Not War
Microsoft+PHP: Make Web Not War
 
The Windows Azure Platform (MSDN Events Series)
The Windows Azure Platform (MSDN Events Series)The Windows Azure Platform (MSDN Events Series)
The Windows Azure Platform (MSDN Events Series)
 
Azure - The Next Frontier
Azure - The Next FrontierAzure - The Next Frontier
Azure - The Next Frontier
 
Internet Explorer 8 Developer Overview
Internet Explorer 8 Developer OverviewInternet Explorer 8 Developer Overview
Internet Explorer 8 Developer Overview
 
Windows 7 Developer Overview
Windows 7 Developer OverviewWindows 7 Developer Overview
Windows 7 Developer Overview
 
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
 
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
 
Silverlight 2
Silverlight 2Silverlight 2
Silverlight 2
 
Building Applications for SQL Server 2008
Building Applications for SQL Server 2008Building Applications for SQL Server 2008
Building Applications for SQL Server 2008
 
A Lap Around Windows Azure
A Lap Around Windows AzureA Lap Around Windows Azure
A Lap Around Windows Azure
 
WPF Unleashed: Building Application with Visual Studio 2008 SP1
WPF Unleashed: Building Application with Visual Studio 2008 SP1WPF Unleashed: Building Application with Visual Studio 2008 SP1
WPF Unleashed: Building Application with Visual Studio 2008 SP1
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF Demystified
 
A Tour of CodePlex
A Tour of CodePlexA Tour of CodePlex
A Tour of CodePlex
 
WPF Applications, It's all about XAML these days
WPF Applications, It's all about XAML these daysWPF Applications, It's all about XAML these days
WPF Applications, It's all about XAML these days
 

Recently uploaded

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 

Recently uploaded (20)

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 

Introduction to Silverlight for Windows Phone

  • 1. An Introduction to Silverlight Dave Bost dave.bost@microsoft.com http://davebost.com | @davebost
  • 2. Topics  The Metro design style  Silverlight Components  Creating a Silverlight Application  Silverlight and XAML  Introduction to Silverlight Layout  Components and Events  Silverlight Project Templates  ApplicationBar  Page Navigation 2 Windows Phone
  • 4. Windows Phone and Metro  To make life easier for us the Metro style is “baked in” to the Windows developer tools  The default appearance, behaviour and fonts of the user elements all match the style  If you want to find out more about Metro on phone you can read the “User Experience Design Guidelines” http://msdn.microsoft.com 4 Windows Phone
  • 5. Tools for the job : Graphical Design separates the  Great design graphical design aspects from the programming  The designer works on the look and feel of the application  The programmer implements the required behaviours  Silverlight is designed to support this  A Silverlight designer can use the “Expression Blend” to specify the appearance of the user 5 interface Windows Phone 5
  • 6. Metro Templates and Components  Visual Studio provides a set of Metro project templates  Each of them maps onto a particular style of application 6 Windows Phone 6
  • 7. Application Types and Templates  The three application types provide quite different user experiences  Select the one that you feel is the most appropriate 7 Windows Phone 7
  • 8. Silverlight display elements  Application title  Page title  First number  Plus text  Second number  Equals button  Result text 8 Windows Phone 8
  • 9. Silverlight element class hierarchy FrameworkElement  The Silverlight class hierarchy is quite complex TextBlock Control  Everything is based on the FrameworkElement class which contains the fundamental properties TextBox ContentControl of all elements  You can derive your own components if you wish ButtonBase Button 9 Windows Phone 9
  • 10. Elements in AddingMachine  The adding machine actually contains three different types of Silverlight display element  TextBox  Used to receive user input from the keyboard  TextBlock  Used to display messages to the user  Button  Used to cause events in the application 1 Windows Phone 10 0
  • 11. Elements and XAML <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <TextBox Height="72" HorizontalAlignment="Left" Margin="8,19,0,0" Name="firstNumberTextBox" Text="0" VerticalAlignment="Top" Width="460" TextAlignment="Center" /> . . . <Button Content="equals" Height="72" HorizontalAlignment="Left" Margin="158,275,0,0" Name="equalsButton" VerticalAlignment="Top" Width="160" Click="equalsButton_Click" /> . . . </Grid>  XAML is the markup language that describes the Silverlight UI components 1 Windows Phone 11 1
  • 12. Grid container element <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <TextBox Height="72" HorizontalAlignment="Left" Margin="8,19,0,0" Name="firstNumberTextBox" Text="0" VerticalAlignment="Top" Width="460" TextAlignment="Center" /> . . . <Button Content="equals" Height="72" HorizontalAlignment="Left" Margin="158,275,0,0" Name="equalsButton" VerticalAlignment="Top" Width="160" Click="equalsButton_Click" /> . . . </Grid>  Grid is a container into which you can position display elements 1 Windows Phone 12 2
  • 13. TextBox element <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <TextBox Height="72" HorizontalAlignment="Left" Margin="8,19,0,0" Name="firstNumberTextBox" Text="0" VerticalAlignment="Top" Width="460" TextAlignment="Center" /> . . . <Button Content="equals" Height="72" HorizontalAlignment="Left" Margin="158,275,0,0" Name="equalsButton" VerticalAlignment="Top" Width="160" Click="equalsButton_Click" /> . . . </Grid>  TextBox is used for text entry  TextBlock can be used for text display 1 Windows Phone 13 3
  • 14. Button element <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <TextBox Height="72" HorizontalAlignment="Left" Margin="8,19,0,0" Name="firstNumberTextBox" Text="0" VerticalAlignment="Top" Width="460" TextAlignment="Center" /> . . . <Button Content="equals" Height="72" HorizontalAlignment="Left" Margin="158,275,0,0" Name="equalsButton" VerticalAlignment="Top" Width="160" Click="equalsButton_Click" /> . . . </Grid>  Button is used for user actions and generates events when activated 1 Windows Phone 14 4
  • 15. Button element <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <TextBox Height="72" HorizontalAlignment="Left" Margin="8,19,0,0" Name="firstNumberTextBox" Text="0" VerticalAlignment="Top" Width="460" TextAlignment="Center" /> . . . <Button Content="equals" Height="72" HorizontalAlignment="Left" Margin="158,275,0,0" Name="equalsButton" VerticalAlignment="Top" Width="160" Click="equalsButton_Click" /> . . . </Grid>  Click is the button clicked event which is bound to the method specified 1 Windows Phone 15 5
  • 16. Button click event handler private void equalsButton_Click(object sender, RoutedEventArgs e) { float v1 = float.Parse(firstNumberTextBox.Text); float v2 = float.Parse(secondNumberTextBox.Text); float result = v1 + v2; resultTextBlock.Text = result.ToString(); }  The event hander for the button takes the values out of the textboxes, parses them and then calculates and displays the result 1 Windows Phone 16 6
  • 18. Best Practice: Keyboard use  It is best if the user can still press the equals button when the keyboard is displayed  This means the equals button should be moved up the screen 1 Windows Phone 18 8
  • 19. Selecting Orientations SupportedOrientations="Portrait" SupportedOrientations="PortraitOrLandscape"  A XAML property for the phone application page lets you select the orientation options available  Your application can bind to an event which is fired when the orientation changes 1 Windows Phone 19 9
  • 20. Using a StackPanel <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <StackPanel> <TextBox Height="72" HorizontalAlignment="Center" .../> <TextBlock Height="56" HorizontalAlignment="Center" .../> <TextBox Height="72" HorizontalAlignment="Center" .../> <Button Content="equals" Height="72" ...> <TextBlock Height="46" HorizontalAlignment="Center" .../> </StackPanel> </Grid>  To automatically handle orientation change we can use a StackPanel container that will stack the display components 2 Windows Phone 20 0
  • 22. Handling errors try { v1 = float.Parse(firstNumberTextBox.Text); v2 = float.Parse(secondNumberTextBox.Text); } catch { MessageBox.Show("Invalid number"); return; }  A program can catch errors as on the desktop  There is also a MessageBox mechanism as well 2 Windows Phone 22 2
  • 23. Configuring the input scope <TextBox InputScope="Number" ...  If all you want from the user is a number it is dangerous to allow them to enter text as well  You can add to the XAML to specify that the keyboard only accepts numbers 2 Windows Phone 23 3
  • 26. Application Chrome System Tray and Application Bar  System Tray  System owned indicator area that displays system-level status information  Apps can show/hide  Microsoft.Phone.Shell.SystemTray.IsVisib le = false;  Application Bar  Area where applications can display buttons for the most common tasks  Can display pop-up menu for less common tasks 2 Windows Phone 26 6
  • 28. Application Bar in Xaml <phone:PhoneApplicationPage x:Class=“MyApp.MainPage” … > <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar x:Name="AppBar" IsMenuEnabled="True"> <shell:ApplicationBar.Buttons> <shell:ApplicationBarIconButton x:Name="NewContactButton" IconUri="Images/appbar.new.rest.png" Text="New" Click="NewContactButton_Click"/> <shell:ApplicationBarIconButton x:Name="SearchButton" IconUri="Images/appbar.feature.search.rest.png" Text="Find" Click="SearchButton_Click"/> </shell:ApplicationBar.Buttons> <shell:ApplicationBar.MenuItems> <shell:ApplicationBarMenuItem x:Name="GenerateMenuItem" Text="Generate Data" Click="GenerateMenuItem_Click" /> <shell:ApplicationBarMenuItem x:Name="ClearMenuItem" Text="Clear Data" Click="ClearMenuItem_Click" /> </shell:ApplicationBar.MenuItems> </shell:ApplicationBar> </phone:PhoneApplicationPage.ApplicationBar> 2 Windows Phone 28 8
  • 29. App Bar & Landscape 2 Windows Phone 9
  • 31. Frame and Page  Frame  Top-level container control  PhoneApplicationFrame class  Contains the page control and system elements such as system tray and application bar  Page  Fills the entire content region of the frame  PhoneApplicationPage-derived class  Contains a title  Optionally surfaces its own application bar 3 Windows Phone 1
  • 32. Page Navigation  Silverlight on Windows Phone uses a Page-based navigation model  Similar to web page model  Each page identified by a URI  Each page is essentially stateless private void hyperlinkButton1_Click( object sender, RoutedEventArgs e) { NavigationService.Navigate( new Uri("/SecondPage.xaml", UriKind.RelativeOrAbsolute) ); } 3 Windows Phone 2
  • 33. Navigating Back  Application can provide controls to navigate back to preceding page private void button1_Click( object sender, RoutedEventArgs e) { NavigationService.GoBack(); }  The hardware Back key will also navigate back to preceding page  No code required – built-in behaviour 3 Windows Phone 3
  • 34. Demo ApplicationBar, Page Navigation and Pivot Control 34
  • 35. Review  Windows Phone applications use Silverlight to express the design of their user interface  The design is expressed in a XAML text file that identifies and configures display elements  Elements can also be manipulated as code objects  There are a set of Silverlight templates for applications and elements based on the Metro design  You can create multiple Silverlight pages and add them to your project  Navigation to pages is performed on the basis of uri (Uniform Resource Indicator) values  The back button normally navigates back to the source page, but this can be overridden  3 The uri can contain simple text messages Windows Phone 35 5  Pages can share larger objects in the App.xaml page
  • 36. Bonus (and really good to know)
  • 37. Silverlight Toolkit for Windows Phone the Microsoft Silverlight team A product of  The Silverlight Toolkit adds tons of additional controls „out of band‟ from the official product control set  Includes full open source code, samples, documentation, and design- time support for controls  Refresh every 3 months or so  Bug fixes  New controls  http://silverlight.codeplex.com 3 7
  • 38. NuGet  Package management system for .NET  Simplifies incorporating 3rd party libraries  Developer focused  Free, open source  Install NuGet using the Visual Studio Extension Manager  Use NuGet to add libraries such as the Silverlight Toolkit to your project 3 Windows Phone 8
  • 39. Q&A