Monday, May 5, 2014

Windows Mobile 8 ApplicationBar Example

Windows Mobile 8 ApplicationBar Example

Today we are going to see how to create applicationbar and click function for windows mobile 8.
Create the layout main.xaml file.

add the following the code application bar and add the icons for applicationbarHow to add the icons .I have created folder name called images .Below see the sreenshot



<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" >
<shell:ApplicationBarIconButton IconUri="/images/button_plus_green.png" Text="Add Me" />
<shell:ApplicationBarIconButton IconUri="/images/remove.png" Text="Delete" ></shell:ApplicationBarIconButton>

</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>

Full .xaml source code

<phone:PhoneApplicationPage
    x:Class="VjFirst.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"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
       
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" >
            <shell:ApplicationBarIconButton IconUri="/images/button_plus_green.png" Text="Add Me" />
            <shell:ApplicationBarIconButton IconUri="/images/remove.png" Text="Delete" ></shell:ApplicationBarIconButton>

        </shell:ApplicationBar>
       
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>

output



No comments:

Post a Comment