Blograby

The User Interface

Listing 2.1 contains the very simple user interface for Flashlight, which uses the application bar shown previously and places only a grid inside the page. The result is shown in Figure 2.6, with the menu visible.

The Flashlight user interface, with the menu showing.
FIGURE 2.6 The Flashlight user interface, with the menu showing.

LISTING 2.1 MainPage.xaml—The User Interface for Flashlight

[code]

<phone:PhoneApplicationPage
x:Class=”WindowsPhoneApp.MainPage”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:phone=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone”
xmlns:shell=”clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone”
SupportedOrientations=”PortraitOrLandscape”>
<phone:PhoneApplicationPage.ApplicationBar>
<!– The ApplicationBar object: –>
<shell:ApplicationBar Opacity=”.5”>
<!– Two buttons: –>
<shell:ApplicationBarIconButton Text=”sos” IconUri=”Images/sos.png”
Click=”SosButton_Click”/>
<shell:ApplicationBarIconButton Text=”strobe” IconUri=”Images/strobe.png”
Click=”StrobeButton_Click”/>
<!– Eight menu items: –>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text=”red”/>
<shell:ApplicationBarMenuItem Text=”orange”/>
<shell:ApplicationBarMenuItem Text=”yellow”/>
<shell:ApplicationBarMenuItem Text=”green”/>
<shell:ApplicationBarMenuItem Text=”cyan”/>
<shell:ApplicationBarMenuItem Text=”purple”/>
<shell:ApplicationBarMenuItem Text=”gray”/>
<shell:ApplicationBarMenuItem Text=”white”/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
<!– No content other than a solid background: –>
<Grid x:Name=”BackgroundGrid” Background=”White”/>
</phone:PhoneApplicationPage>

[/code]

Notes:

 

Exit mobile version