2014-06-06 35 views
0


我正在創建一個Windows Phone 8應用程序。該應用程序有一個關鍵。要求是在樞軸頂部有一個靜態塊來顯示需要始終存在的數據,而不管當前哪個樞軸是可見的。一個例子是AccuWeather應用程序。
我已經嘗試了放置一個堆疊面板,列表視圖,文本框等,但都控制覆蓋在同一個網格下,但它不起作用。
此外,我已經嘗試將另一個網格放置在保持樞軸的網格的頂部,頁面停止在這種情況下顯示。
任何指針/如何解決問題的幫助?
我已經搜索了網頁,但無法找到適當的信息。在Windows Phone 8應用中將網格放置在網格下方

回答

0

試試這個:

[<phone:PhoneApplicationPage 
    x:Class="SampleStackPivotApp.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" 
    d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}" 
    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> 

     <!--Static Control Block--> 
     <Grid x:Name="StaticContentGrid" Margin="12,0,12,0"> 
      <StackPanel> 
       <TextBlock Text="Some Content goes Here" FontSize="30"></TextBlock> 
       <TextBlock Text="Another Content goes Here" ></TextBlock> 
      </StackPanel> 
     </Grid> 


     <!--Pivot Control--> 
     <phone:Pivot Grid.Row="1"> 
      <phone:Pivot.Title> 
        <StackPanel> 
         <TextBlock Text="Pivot Name Goes here"></TextBlock> 
        </StackPanel> 
      </phone:Pivot.Title> 
      <!--Pivot item one--> 
      <phone:PivotItem Header="first"> 
       <!--Double line list with text wrapping--> 
       <phone:LongListSelector Margin="0,0,-12,0" ItemsSource="{Binding Items}"> 
        <phone:LongListSelector.ItemTemplate> 
         <DataTemplate> 
          <StackPanel Margin="0,0,0,17"> 
           <TextBlock Text="{Binding LineOne}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/> 
           <TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/> 
          </StackPanel> 
         </DataTemplate> 
        </phone:LongListSelector.ItemTemplate> 
       </phone:LongListSelector> 
      </phone:PivotItem> 

      <!--Pivot item two--> 
      <phone:PivotItem Header="second"> 
       <!--Double line list no text wrapping--> 
       <phone:LongListSelector Margin="0,0,-12,0" ItemsSource="{Binding Items}"> 
        <phone:LongListSelector.ItemTemplate> 
          <DataTemplate> 
           <StackPanel Margin="0,0,0,17"> 
            <TextBlock Text="{Binding LineOne}" TextWrapping="NoWrap" Margin="12,0,0,0" Style="{StaticResource PhoneTextExtraLargeStyle}"/> 
            <TextBlock Text="{Binding LineThree}" TextWrapping="NoWrap" Margin="12,-6,0,0" Style="{StaticResource PhoneTextSubtleStyle}"/> 
           </StackPanel> 
          </DataTemplate> 
        </phone:LongListSelector.ItemTemplate> 
       </phone:LongListSelector> 
      </phone:PivotItem> 
     </phone:Pivot> 
    </Grid> 
</phone:PhoneApplicationPage>][1]