Advertisement
garfbradaz

Issue with LayoutAwarePage

Nov 19th, 2012
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.44 KB | None | 0 0
  1.  
  2. <common:LayoutAwarePage
  3.    x:Name="pageRoot"
  4.    x:Class="Accountable.BasicPage1"
  5.    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
  6.    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  7.    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  8.    xmlns:local="using:Accountable"
  9.    xmlns:common="using:Accountable.Common"
  10.    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  11.    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  12.    mc:Ignorable="d">
  13.  
  14.     <Page.Resources>
  15.  
  16.         <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
  17.         <x:String x:Key="AppName">My Application</x:String>
  18.     </Page.Resources>
  19.  
  20.     <!--
  21.        This grid acts as a root panel for the page that defines two rows:
  22.        * Row 0 contains the back button and page title
  23.        * Row 1 contains the rest of the page layout
  24.    -->
  25.     <Grid Style="{StaticResource LayoutRootStyle}">
  26.         <Grid.RowDefinitions>
  27.             <RowDefinition Height="140"/>
  28.             <RowDefinition Height="*"/>
  29.         </Grid.RowDefinitions>
  30.  
  31.         <!-- Back button and page title -->
  32.         <Grid>
  33.             <Grid.ColumnDefinitions>
  34.                 <ColumnDefinition Width="Auto"/>
  35.                 <ColumnDefinition Width="*"/>
  36.             </Grid.ColumnDefinitions>
  37.             <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
  38.             <TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}" Style="{StaticResource PageHeaderTextStyle}"/>
  39.         </Grid>
  40.  
  41.         <VisualStateManager.VisualStateGroups>
  42.  
  43.             <!-- Visual states reflect the application's view state -->
  44.             <VisualStateGroup x:Name="ApplicationViewStates">
  45.                 <VisualState x:Name="FullScreenLandscape"/>
  46.                 <VisualState x:Name="Filled"/>
  47.  
  48.                 <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
  49.                 <VisualState x:Name="FullScreenPortrait">
  50.                     <Storyboard>
  51.                         <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
  52.                             <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
  53.                         </ObjectAnimationUsingKeyFrames>
  54.                     </Storyboard>
  55.                 </VisualState>
  56.  
  57.                 <!-- The back button and title have different styles when snapped -->
  58.                 <VisualState x:Name="Snapped">
  59.                     <Storyboard>
  60.                         <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
  61.                             <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
  62.                         </ObjectAnimationUsingKeyFrames>
  63.                         <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
  64.                             <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
  65.                         </ObjectAnimationUsingKeyFrames>
  66.                     </Storyboard>
  67.                 </VisualState>
  68.             </VisualStateGroup>
  69.         </VisualStateManager.VisualStateGroups>
  70.     </Grid>
  71. </common:LayoutAwarePage>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement