我正在创建一个windows 8应用程序。应用程序具有支点。所需的是在枢轴顶部有一个静态块来显示数据,这些数据无论当前可见于哪个枢轴,都需要始终显示。它的一个例子是AccuWeather应用程序。
我尝试过放置堆栈面板、列表视图、文本框等,但这两个控件都在同一个网格下覆盖,但它不起作用。
另外,我还尝试将另一个网格放置在支撑支点的网格上,在这种情况下,页面将停止显示。
关于如何解决这个问题,有什么建议/帮助吗?
我在网上搜索过,但找不到合适的信息。
发布于 2014-06-06 04:43:52
试试这个:
[<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]https://stackoverflow.com/questions/24072880
复制相似问题