<phone:PhoneApplicationPage 
    x:Class="MyFriendsAround.WP7.Views.SettingsPage"
    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" xmlns:binding="clr-namespace:Coding4Fun.Phone.Controls.Binding;assembly=Coding4Fun.Phone.Controls" xmlns:Preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    DataContext="{Binding Main, Source={StaticResource Locator}}"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True">

    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <cmd:EventToCommand Command="{Binding MainLoadCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    
    <!--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>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,12,0,12">
            <TextBlock x:Name="ApplicationTitle" Text="{Binding Path=ApplicationTitle}" Style="{StaticResource PhoneTextNormalStyle}"
                       Foreground="{StaticResource PhoneAccentBrush}" />
            <TextBlock x:Name="PageTitle"
                       Text="{Binding Path=PageNameSettings}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

            <StackPanel 
                Orientation="Vertical"
                Margin="6,0,0,6"
                >
            <TextBlock Text="My Name"
                           Style="{StaticResource PhoneTextTitle3Style}"
                           />
            <TextBox Height="67"
                     HorizontalAlignment="Stretch"     
                     Name="txtMyName"
                     Text="{Binding Path=MyName, Mode=TwoWay}"
                     VerticalAlignment="Top"
                     binding:TextBoxBinding.UpdateSourceOnChange="True" />
                <TextBlock Text="My Picture"
                           Style="{StaticResource PhoneTextTitle3Style}" />
                <Button x:Name="btnChoosePhoto"
                        Margin="0, 24, 0, 24"
                        Width="200"
                        Height="200"
                        Background="{StaticResource PhoneAccentBrush}"
                        BorderThickness="0"
                        Padding="0"
                        >
                    <Image x:Name="myPicture"
                           HorizontalAlignment="Stretch"
                           VerticalAlignment="Stretch"
                           Stretch="Uniform"
                           Margin="1"
                           Source="{Binding MyPicture, Mode=TwoWay}"></Image>
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <cmd:EventToCommand 
                                Command="{Binding ChoosePhotoCommand}" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
            </StackPanel>
        </Grid>

        <Preview:BindableApplicationBar x:Name="AppBar"
                                        BarOpacity="0.8">
            <Preview:BindableApplicationBarIconButton Command="{Binding SaveMySettingsCommand}"
                                                      IconUri="/Toolkit.Content/ApplicationBar.Check.png"
                                                      Text="{Binding AppBarTextSaveSettings}"
                                                      IsEnabled="{Binding Path=IsBusy, Converter={StaticResource InvertValueConverter1}}" />
            <Preview:BindableApplicationBarIconButton Command="{Binding CancelMySettingsCommand}"
                                                      IconUri="/Toolkit.Content/ApplicationBar.Cancel.png"
                                                      Text="{Binding AppBarTextCancelSettings}" />
        </Preview:BindableApplicationBar>
    </Grid>
 

</phone:PhoneApplicationPage>
