SlideShare une entreprise Scribd logo
1  sur  40
An
Introduction to
Silverlight
Ed Donahue
Academic Developer Evangelist

ed.donahue@microsoft.com
creepyed.com | @creepyed
Ed Donahue
Salsa dancer
Light jogger
Casual cyclist
Swimmer
Triathlete (for those
counting)
Computer science major
Lover of monospaced
fonts
Supporter of women
in tech
Microsoft Academic
Developer Evangelist
                               2
ed.donahue@microsoft.com | www.creepyed.com | @creepyed
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
   Demos available here: http://bit.ly/EdDemos



    Windows Phone
Looking for training kits?

   Windows Phone 7 Mango Training Kit


        http://bit.ly/wp7mangotraining




    Windows Phone
Help moving from other
platforms?
   Leverage your iPhone dev skills

                      http://bit.ly/ios2wp7

   Leverage your Android dev skills

                    http://bit.ly/android2wp7

    Windows Phone                     5
Metro
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://bit.ly/DesignGuideWP7



    Windows Phone
Tools for the job : Graphical
Design separates the
Good planning
  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 interface
      A version of Blend for the
       phone is supplied as part of the
       phone SDK

    Windows Phone
Metro Templates and
Components
 Visual Studio
  provides a set of
  Metro project
  templates
 Each of them
  maps onto a
  particular style of
  application




    Windows Phone
Application Types and Templates




 The three application types provide quite different user experiences
 Select the one that you feel is the most appropriate
    Windows Phone
Silverlight display elements

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




    Windows Phone
Elements in AddingMachine

 The adding machine actually contains three different types of Silverlight
  display elements
 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




    Windows Phone
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

     Windows Phone
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

     Windows Phone
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

     Windows Phone
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


     Windows Phone
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

     Windows Phone
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


        Windows Phone
Demo


The Silverlight Adding Machine


                                 21
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




    Windows Phone
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




    Windows Phone
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

     Windows Phone
Demo


Orientation Handling

                       25
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



     Windows Phone
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




     Windows Phone
Demo

Complete Adding
Machine

                  28
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

    Windows Phone
Application Bar
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>




    Windows Phone
App Bar & Landscape




 Windows Phone
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
    Windows Phone
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)
      );
    }



     Windows Phone
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



    Windows Phone
Demo


ApplicationBar and Page Navigation

                                     38
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
   The uri can contain simple text messages
     Windows Phone
   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

Contenu connexe

Tendances

Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lecturesmarwaeng
 
Chapter 07
Chapter 07Chapter 07
Chapter 07llmeade
 
INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS Prof Ansari
 
130297267 transformations
130297267 transformations130297267 transformations
130297267 transformationsSunil Pandey
 
Grasping The LightSwitch Paradigm
Grasping The LightSwitch ParadigmGrasping The LightSwitch Paradigm
Grasping The LightSwitch ParadigmAndrew Brust
 
Chapter 03 - Program Coding and Design
Chapter 03 - Program Coding and DesignChapter 03 - Program Coding and Design
Chapter 03 - Program Coding and Designpatf719
 
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.
 
06 win forms
06 win forms06 win forms
06 win formsmrjw
 
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 6Ella Marie Wico
 
Power Point Project 5
Power Point Project 5Power Point Project 5
Power Point Project 5lonetree
 
Mockapp library 100
Mockapp library 100Mockapp library 100
Mockapp library 100comdes
 
Vista Users Guide
Vista Users GuideVista Users Guide
Vista Users Guidenoverm1
 
Windows 8 Unit A
Windows 8 Unit AWindows 8 Unit A
Windows 8 Unit Ajarana00
 
Module 8-Grade center-Task 1
Module 8-Grade center-Task 1Module 8-Grade center-Task 1
Module 8-Grade center-Task 1EDIT3318
 

Tendances (19)

Software engineering modeling lab lectures
Software engineering modeling lab lecturesSoftware engineering modeling lab lectures
Software engineering modeling lab lectures
 
Chapter03 Ppt
Chapter03 PptChapter03 Ppt
Chapter03 Ppt
 
Chapter 07
Chapter 07Chapter 07
Chapter 07
 
INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS
 
Android UI
Android UIAndroid UI
Android UI
 
130297267 transformations
130297267 transformations130297267 transformations
130297267 transformations
 
Sql injections
Sql injectionsSql injections
Sql injections
 
Grasping The LightSwitch Paradigm
Grasping The LightSwitch ParadigmGrasping The LightSwitch Paradigm
Grasping The LightSwitch Paradigm
 
Chapter 03 - Program Coding and Design
Chapter 03 - Program Coding and DesignChapter 03 - Program Coding and Design
Chapter 03 - Program Coding and Design
 
Visual Basic Controls ppt
Visual Basic Controls pptVisual Basic Controls ppt
Visual Basic Controls ppt
 
Intake 37 9
Intake 37 9Intake 37 9
Intake 37 9
 
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)
 
06 win forms
06 win forms06 win forms
06 win forms
 
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
 
Power Point Project 5
Power Point Project 5Power Point Project 5
Power Point Project 5
 
Mockapp library 100
Mockapp library 100Mockapp library 100
Mockapp library 100
 
Vista Users Guide
Vista Users GuideVista Users Guide
Vista Users Guide
 
Windows 8 Unit A
Windows 8 Unit AWindows 8 Unit A
Windows 8 Unit A
 
Module 8-Grade center-Task 1
Module 8-Grade center-Task 1Module 8-Grade center-Task 1
Module 8-Grade center-Task 1
 

En vedette

Intel Lightning Talk
Intel Lightning TalkIntel Lightning Talk
Intel Lightning TalkEd Donahue
 
AT&T Shape Hackathon Kick-off
AT&T Shape Hackathon Kick-offAT&T Shape Hackathon Kick-off
AT&T Shape Hackathon Kick-offEd Donahue
 
IBM Lightning Talk
IBM Lightning TalkIBM Lightning Talk
IBM Lightning TalkEd Donahue
 
Cisco Lightning Talk
Cisco Lightning TalkCisco Lightning Talk
Cisco Lightning TalkEd Donahue
 
AT&T IoT Hackathon - Seattle
AT&T IoT Hackathon - SeattleAT&T IoT Hackathon - Seattle
AT&T IoT Hackathon - SeattleEd Donahue
 
AT&T Public Sector Hackathon
AT&T Public Sector HackathonAT&T Public Sector Hackathon
AT&T Public Sector HackathonEd Donahue
 
Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016
Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016
Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016Portal NE10
 
AT&T IoT Hackathon - Dallas (hosted by The DEC)
AT&T IoT Hackathon - Dallas (hosted by The DEC)AT&T IoT Hackathon - Dallas (hosted by The DEC)
AT&T IoT Hackathon - Dallas (hosted by The DEC)Ed Donahue
 

En vedette (8)

Intel Lightning Talk
Intel Lightning TalkIntel Lightning Talk
Intel Lightning Talk
 
AT&T Shape Hackathon Kick-off
AT&T Shape Hackathon Kick-offAT&T Shape Hackathon Kick-off
AT&T Shape Hackathon Kick-off
 
IBM Lightning Talk
IBM Lightning TalkIBM Lightning Talk
IBM Lightning Talk
 
Cisco Lightning Talk
Cisco Lightning TalkCisco Lightning Talk
Cisco Lightning Talk
 
AT&T IoT Hackathon - Seattle
AT&T IoT Hackathon - SeattleAT&T IoT Hackathon - Seattle
AT&T IoT Hackathon - Seattle
 
AT&T Public Sector Hackathon
AT&T Public Sector HackathonAT&T Public Sector Hackathon
AT&T Public Sector Hackathon
 
Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016
Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016
Veja lista da 1ª etapa do concurso da PM de Pernambuco 2016
 
AT&T IoT Hackathon - Dallas (hosted by The DEC)
AT&T IoT Hackathon - Dallas (hosted by The DEC)AT&T IoT Hackathon - Dallas (hosted by The DEC)
AT&T IoT Hackathon - Dallas (hosted by The DEC)
 

Similaire à Introduction to Silverlight

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 appsWindowsPhoneRocks
 
05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & AnimationNguyen Tuan
 
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
 
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 8netmind
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발영욱 김
 
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 2013Fons Sonnemans
 
데브멘토 발표세미나
데브멘토 발표세미나데브멘토 발표세미나
데브멘토 발표세미나Seo Jinho
 
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 widgetsSiva Kumar reddy Vasipally
 
4.preference management
4.preference management 4.preference management
4.preference management maamir farooq
 
Unique features of windows 8
Unique features of windows 8Unique features of windows 8
Unique features of windows 8FITC
 
Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersAmbarish Hazarnis
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0Aarti P
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)pbarasia
 
Html,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tagsHtml,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tagsJeirahTigas
 

Similaire à Introduction to Silverlight (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
 
Android
AndroidAndroid
Android
 
05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation05.Blend Expression, Transformation & Animation
05.Blend Expression, Transformation & Animation
 
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
 
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
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발
 
Android Button
Android ButtonAndroid Button
Android Button
 
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
 
4.C#
4.C#4.C#
4.C#
 
데브멘토 발표세미나
데브멘토 발표세미나데브멘토 발표세미나
데브멘토 발표세미나
 
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
 
Session 5#
Session 5#Session 5#
Session 5#
 
Sencha touch
Sencha touchSencha touch
Sencha touch
 
4.preference management
4.preference management 4.preference management
4.preference management
 
Unique features of windows 8
Unique features of windows 8Unique features of windows 8
Unique features of windows 8
 
Titanium Appcelerator - Beginners
Titanium Appcelerator - BeginnersTitanium Appcelerator - Beginners
Titanium Appcelerator - Beginners
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
WPF - An introduction
WPF - An introductionWPF - An introduction
WPF - An introduction
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
Html,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tagsHtml,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tags
 

Plus de Ed Donahue

AT&T Hackathon Hawaii
AT&T Hackathon HawaiiAT&T Hackathon Hawaii
AT&T Hackathon HawaiiEd Donahue
 
AT&T Hack-o-ween
AT&T Hack-o-weenAT&T Hack-o-ween
AT&T Hack-o-weenEd Donahue
 
AT&T Government Hackathon, Washington DC. 10/6/2017
AT&T Government Hackathon, Washington DC. 10/6/2017AT&T Government Hackathon, Washington DC. 10/6/2017
AT&T Government Hackathon, Washington DC. 10/6/2017Ed Donahue
 
AT&T IoT Civic Hackathon @ IndyPy
AT&T IoT Civic Hackathon @ IndyPyAT&T IoT Civic Hackathon @ IndyPy
AT&T IoT Civic Hackathon @ IndyPyEd Donahue
 
AT&T VR/AR Hackathon - Seattle
AT&T VR/AR Hackathon - SeattleAT&T VR/AR Hackathon - Seattle
AT&T VR/AR Hackathon - SeattleEd Donahue
 
BIAC Hackathon Kick-off
BIAC Hackathon Kick-offBIAC Hackathon Kick-off
BIAC Hackathon Kick-offEd Donahue
 
BIAC Hackathon Lightning Talks
BIAC Hackathon Lightning TalksBIAC Hackathon Lightning Talks
BIAC Hackathon Lightning TalksEd Donahue
 
AT&T Smart Cities Hackathon
AT&T Smart Cities HackathonAT&T Smart Cities Hackathon
AT&T Smart Cities HackathonEd Donahue
 
AT&T Mobile App & IoT Hackathon @ Catalyst
AT&T Mobile App & IoT Hackathon @ Catalyst AT&T Mobile App & IoT Hackathon @ Catalyst
AT&T Mobile App & IoT Hackathon @ Catalyst Ed Donahue
 
AT&T Mobile App Hackathon (Smart City) - Berkeley
AT&T Mobile App Hackathon (Smart City) - BerkeleyAT&T Mobile App Hackathon (Smart City) - Berkeley
AT&T Mobile App Hackathon (Smart City) - BerkeleyEd Donahue
 
AT&T Mobile App Hackathon - Seattle
AT&T Mobile App Hackathon - SeattleAT&T Mobile App Hackathon - Seattle
AT&T Mobile App Hackathon - SeattleEd Donahue
 
Malvern WOWZAPP Info
Malvern WOWZAPP InfoMalvern WOWZAPP Info
Malvern WOWZAPP InfoEd Donahue
 
Windows 8 Contracts
Windows 8 ContractsWindows 8 Contracts
Windows 8 ContractsEd Donahue
 
Windows 8 Tiles and Notifications
Windows 8 Tiles and NotificationsWindows 8 Tiles and Notifications
Windows 8 Tiles and NotificationsEd Donahue
 
Windows 8 Platform & Store
Windows 8 Platform & StoreWindows 8 Platform & Store
Windows 8 Platform & StoreEd Donahue
 
Game Development: A Crash Course
Game Development: A Crash CourseGame Development: A Crash Course
Game Development: A Crash CourseEd Donahue
 
Gaming Board Presentation
Gaming Board PresentationGaming Board Presentation
Gaming Board PresentationEd Donahue
 
PGCC Lunch & Learn: Windows Phone
PGCC Lunch & Learn: Windows PhonePGCC Lunch & Learn: Windows Phone
PGCC Lunch & Learn: Windows PhoneEd Donahue
 
Imagine Cup at CWIC2012
Imagine Cup at CWIC2012Imagine Cup at CWIC2012
Imagine Cup at CWIC2012Ed Donahue
 

Plus de Ed Donahue (20)

AT&T Hackathon Hawaii
AT&T Hackathon HawaiiAT&T Hackathon Hawaii
AT&T Hackathon Hawaii
 
AT&T Hack-o-ween
AT&T Hack-o-weenAT&T Hack-o-ween
AT&T Hack-o-ween
 
AT&T Government Hackathon, Washington DC. 10/6/2017
AT&T Government Hackathon, Washington DC. 10/6/2017AT&T Government Hackathon, Washington DC. 10/6/2017
AT&T Government Hackathon, Washington DC. 10/6/2017
 
AT&T IoT Civic Hackathon @ IndyPy
AT&T IoT Civic Hackathon @ IndyPyAT&T IoT Civic Hackathon @ IndyPy
AT&T IoT Civic Hackathon @ IndyPy
 
AT&T VR/AR Hackathon - Seattle
AT&T VR/AR Hackathon - SeattleAT&T VR/AR Hackathon - Seattle
AT&T VR/AR Hackathon - Seattle
 
BIAC Hackathon Kick-off
BIAC Hackathon Kick-offBIAC Hackathon Kick-off
BIAC Hackathon Kick-off
 
BIAC Hackathon Lightning Talks
BIAC Hackathon Lightning TalksBIAC Hackathon Lightning Talks
BIAC Hackathon Lightning Talks
 
AT&T Smart Cities Hackathon
AT&T Smart Cities HackathonAT&T Smart Cities Hackathon
AT&T Smart Cities Hackathon
 
AT&T Mobile App & IoT Hackathon @ Catalyst
AT&T Mobile App & IoT Hackathon @ Catalyst AT&T Mobile App & IoT Hackathon @ Catalyst
AT&T Mobile App & IoT Hackathon @ Catalyst
 
AT&T Mobile App Hackathon (Smart City) - Berkeley
AT&T Mobile App Hackathon (Smart City) - BerkeleyAT&T Mobile App Hackathon (Smart City) - Berkeley
AT&T Mobile App Hackathon (Smart City) - Berkeley
 
AT&T Mobile App Hackathon - Seattle
AT&T Mobile App Hackathon - SeattleAT&T Mobile App Hackathon - Seattle
AT&T Mobile App Hackathon - Seattle
 
Malvern WOWZAPP Info
Malvern WOWZAPP InfoMalvern WOWZAPP Info
Malvern WOWZAPP Info
 
Windows 8 Contracts
Windows 8 ContractsWindows 8 Contracts
Windows 8 Contracts
 
Windows 8 Tiles and Notifications
Windows 8 Tiles and NotificationsWindows 8 Tiles and Notifications
Windows 8 Tiles and Notifications
 
Windows 8 Platform & Store
Windows 8 Platform & StoreWindows 8 Platform & Store
Windows 8 Platform & Store
 
Kodu Game Lab
Kodu Game LabKodu Game Lab
Kodu Game Lab
 
Game Development: A Crash Course
Game Development: A Crash CourseGame Development: A Crash Course
Game Development: A Crash Course
 
Gaming Board Presentation
Gaming Board PresentationGaming Board Presentation
Gaming Board Presentation
 
PGCC Lunch & Learn: Windows Phone
PGCC Lunch & Learn: Windows PhonePGCC Lunch & Learn: Windows Phone
PGCC Lunch & Learn: Windows Phone
 
Imagine Cup at CWIC2012
Imagine Cup at CWIC2012Imagine Cup at CWIC2012
Imagine Cup at CWIC2012
 

Dernier

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Dernier (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Introduction to Silverlight

  • 1. An Introduction to Silverlight Ed Donahue Academic Developer Evangelist ed.donahue@microsoft.com creepyed.com | @creepyed
  • 2. Ed Donahue Salsa dancer Light jogger Casual cyclist Swimmer Triathlete (for those counting) Computer science major Lover of monospaced fonts Supporter of women in tech Microsoft Academic Developer Evangelist 2 ed.donahue@microsoft.com | www.creepyed.com | @creepyed
  • 3. 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  Demos available here: http://bit.ly/EdDemos Windows Phone
  • 4. Looking for training kits?  Windows Phone 7 Mango Training Kit http://bit.ly/wp7mangotraining Windows Phone
  • 5. Help moving from other platforms?  Leverage your iPhone dev skills http://bit.ly/ios2wp7  Leverage your Android dev skills http://bit.ly/android2wp7 Windows Phone 5
  • 6.
  • 8. 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://bit.ly/DesignGuideWP7 Windows Phone
  • 9. Tools for the job : Graphical Design separates the Good planning 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 interface  A version of Blend for the phone is supplied as part of the phone SDK Windows Phone
  • 10. Metro Templates and Components  Visual Studio provides a set of Metro project templates  Each of them maps onto a particular style of application Windows Phone
  • 11. Application Types and Templates  The three application types provide quite different user experiences  Select the one that you feel is the most appropriate Windows Phone
  • 12. Silverlight display elements  Application title  Page title  First number  Plus text  Second number  Equals button  Result text Windows Phone
  • 13. Elements in AddingMachine  The adding machine actually contains three different types of Silverlight display elements  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 Windows Phone
  • 14. 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 Windows Phone
  • 15. 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 Windows Phone
  • 16. 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 Windows Phone
  • 17. 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 Windows Phone
  • 18. 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 Windows Phone
  • 19. 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 Windows Phone
  • 21. 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 Windows Phone
  • 22. 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 Windows Phone
  • 23. 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 Windows Phone
  • 25. 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 Windows Phone
  • 26. 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 Windows Phone
  • 29. 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 Windows Phone
  • 31. 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> Windows Phone
  • 32. App Bar & Landscape Windows Phone
  • 34. 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 Windows Phone
  • 35. 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) ); } Windows Phone
  • 36. 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 Windows Phone
  • 38. 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  The uri can contain simple text messages Windows Phone  Pages can share larger objects in the App.xaml page
  • 39. Bonus (and really good to know)
  • 40. 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

Notes de l'éditeur

  1. 2 Introduction to Silverlight on Windows Phone2.1 Silverlight Background2.1.1 Origins of Silverlight2.1.2 Silverlight elements2.1.2.1 UI/Code Separation2.1.2.2 XAML2.1.2.3 Visual Studio vs Expression Blend2.1.2.4 Silverlight on other platforms2.2 Silverlight Components2.3 Using the Toolbox and Design Surface2.4 Manipulating Components Properties2.5 Text Input Components2.6 Text Output Components2.7 Using XAML to design a User Interface2.8 Introduction to Layout in Silverlight2.9 Components and Events
  2. Make the points that:It doesn’t matter if you are not a good designer, Silverlight is designed to make it easy to leverage design skills from those who areSilverlight on the phone makes it easy to use pre-built components in the Metro style to make applications that look like those built into the phone.Make the point that the Metro style is actually becoming more ingrained in Windows, and that it will play an increasing role in Windows products beyond the phone platform.
  3. Make the points that:It doesn’t matter if you are not a good designer, Silverlight is designed to make it easy to leverage design skills from those who areSilverlight on the phone makes it easy to use pre-built components in the Metro style to make applications that look like those built into the phone.Make the point that the Metro style is actually becoming more ingrained in Windows, and that it will play an increasing role in Windows products beyond the phone platform.
  4. Make the point that the design guidelines are well worth reading. In fact you can’t call yourself a phone developer until you have read them.
  5. Make the point that we will be going into more detail on expression blend in the Advanced Silverlight section, for now we are going to focus on how Silverlight works.
  6. Once you have picked your theme you can then create an application based on that.
  7. Make the point that these are fundamentally the same, in that they are created and managed in exactly the same way.Also make the point that the screens above have been entirely created by the Silverlight templates that are provided as part of Visual StudioThe folder Application Types provides each of the above projects, if you have time to show them in action you can.
  8. Make the point that each of these items are described in the XAML that is created to describe the screen
  9. All GUIs work like this. Make the point that these are descen
  10. Make the point that XAML is text based. It is what Expression Blend produces and it is also produced by the design surface in Visual Studio.
  11. Make the point that some containers will perform the layout for you automatically (for example StackPanel). We will be using these later.
  12. Make the point that there are TextBlocks for displaying output and TextBox for user entry
  13. Make the point that lots of other user actions can generate events (text changed in TextBox etc.
  14. Make the point that this text in the XAML must line up with a method called equalsButton_Click in the code behind the form. Otherwise the program will not build.Of course when you use Visual Studio to bind an event hander this name and the hander code is created automatically.
  15. This is the code that runs when the equals button is clicked.
  16. Use Visual Studio to open the AddingMachineproject in Demo 01 AddingMachineEnsure that the target for the deployment is the Windows Phone 7 EmulatorRun the program.Enter the values of 2 and 2 into the emulator and press equals. Note that the value 4 is displayed.Open the MainPage.xaml.cs source file. (While the program is still running)Put a breakpoint on the first line of the equalsButton_Click methodPress equalsNote that the program stops at the breakpoint.Make the point that you can insert breakpoints into running programs even when the program is running in the device.Step over the assignments of the v1 and v2Rest the cursor over v1 and show that VS displays the value in the variable.Open the Immediate Window in Visual StudioEnter the statementv1=99Run the program on. Note that the program displays the result 101 now.Make the point, again, that this will work on the device too.
  17. This is an important point. Some applications are needlessly hard to use because of the way that the soft keyboard overlays vital controls – in this case the equals button.
  18. This is in the &lt;phone:PhoneApplicationPageelement in the form design XAML for MainPage.XAML
  19. Make the point that if we use the absolute grid positioning our elements are in the wrong place when orientation changes. But a StackPanel container will respond to any particular display dimension.Find out more, including using ScrollViewer and Grid, here:http://bit.ly/t9MwJL
  20. Use Visual Studio to open the AddingMachineproject in Demo 02 Orientation AddingMachineEnsure that the target for the deployment is the Windows Phone 7 EmulatorRun the program.Change the orientation from Portrait to landscape. Note that the program still works OK.Make the point that it only changes orientation because the SupportedOrientation property is set correctly.Open up MainPage.xaml (while the program is still running)Put a breakpoint on PhoneApplicationPage_OrientationChanged (while the program is still running)Change the orientation from landscape to portraitNote that the breakpoint is now hit.Make the point that we could add all kinds of custom code here to reposition elements if we wanted to.
  21. Make the point that at the moment this code is badly written in that any errors are not handled at all. This should be familiar to anyone who has written desktop applications. Make the point that the message box is as shown, and that there are versions that return OK/Cancel type responses too.Make sure that everyone understands how the exceptions work, and what happens when an invalid number is entered.
  22. Of course, by now someone will have told you that the best way to stop the user entering text is to only provide them with a numeric keyboard, as above.Ask the question, do you still need to check for text entry?Answer: Yes, because the user might be typing on a phone that has a physical keyboard and they could use that to enter text instead of numbers. (actually need to check this)Make the point that the soft keyboard can be configured in lots of other ways too, things like whether it is displayed in shift mode first, which layout is used etc etc.
  23. Use Visual Studio to open the AddingMachineproject in Demo 03 Complete AddingMachineEnsure that the target for the deployment is the Windows Phone 7 EmulatorRun the program.Click the top text box and note that the soft keyboard comes up with numeric entry.Press the Pause/Break keyboard and explain that this is how you toggle the physical keyboard on the emulator.Enter the value “one”Click equals and note that the error is displayed.Change the value to a digit, and enter a value into the bottom text box.Click equals.Note that the value is displayed as you would expect.If you have time:Mention that one reason for using these standard components is that they can respond correctly to changes in the colour scheme of the phone.Select Debug&gt;Stop Running from Visual StudioSelect the Emulator program.In the emulator, move to the Settings page.Select ThemeSet the Background value to LightExplain that we can adjust some of the settings of the emulator, including the colour of the display and the background scheme.Click Back to leave the Theme settings.Click Back to return to the programs page.Run the AddingMachineprogram on this page. Explain that we can run any of the programs “inside” the emulator as it maintains a Windows Phone filestore until it is shut down.Note that the colour of the text and the buttons has been changed to work correctly in the new background.Make the point that if you design your own custom colour scheme it must work when the background and colour schemes are changed.