我有这个枢轴控制:
<ScrollViewer Margin="0,104,0,229" HorizontalAlignment="Left">
<Grid Height="800" Width="468">
<phone:Pivot ItemsSource="{Binding DocumentHeaderItemsSearch}">
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock x:Name="ProcessName" Text="{Binding ProcessName}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="48" Margin="2,20,2,2" FontWeight="Bold"/>
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:Pivot.ItemTemplate>
<DataTemplate>
<Grid x:Name="Content" Grid.Row="0" Margin="0,-35,0,0">
<Viewbox x:Name="viewboxHeader" Tag="0">
<Grid Height="80" Width="436">
<Canvas Background="{Binding Urgency, Converter={StaticResource converttocolor}}" Margin="0,0,409,0">
<TextBlock TextWrapping="Wrap" Text="{Binding Duration}" Foreground="Black" RenderTransformOrigin="0.5,0.5" FontSize="{StaticResource PhoneFontSizeNormal}" Canvas.Top="25" UseLayoutRounding="False" d:LayoutRounding="Auto" TextAlignment="Center" FontWeight="Bold" Width="80" Height="28" Canvas.Left="-26" HorizontalAlignment="Center" VerticalAlignment="Center" >
<TextBlock.RenderTransform>
<CompositeTransform Rotation="-90"/>
</TextBlock.RenderTransform>
</TextBlock>
</Canvas>
<TextBlock TextWrapping="Wrap" Text="{Binding DocDesc}" Foreground="White" Margin="31,4,0,44" FontSize="{StaticResource PhoneFontSizeMediumLarge}" FontFamily="{StaticResource PhoneFontFamilyBold}"/>
<TextBlock TextWrapping="Wrap" Text="{Binding Originator}" Margin="31,44,167,4" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="White" FontFamily="{StaticResource PhoneFontFamilySemiLight}"/>
<TextBlock TextWrapping="Wrap" Text="{Binding DocDate, Converter={StaticResource convertshortdate}}" Margin="277,44,0,4" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="White" FontFamily="{StaticResource PhoneFontFamilySemiLight}" HorizontalAlignment="Right"/>
</Grid>
</Viewbox>
</Grid>
</DataTemplate>
</phone:Pivot.ItemTemplate>
</phone:Pivot>
</Grid>
</ScrollViewer>
所以这是我运行应用程序并使用搜索功能时得到的结果:
我如何获得那个显示结果的对象,以便在该项目标题“76”的正下方显示?
我正在使用visual studio 2012,c#,silverlight,windows phone 8,我在这里使用一个支点控件来获得结果
答案 0 :(得分:1)
将DataTemplate中的顶级项目更改为StackPanel吗?或者设置网格的VerticalContentAlignment = Top并设置VerticalAlignment = Top / Stretch是否有效?您可以贪婪并使用PivotItem.ItemTemplate中的所有空间同时对齐顶部,或者主动注意空间并对齐顶部。
此外,在测试期间,您应该考虑删除顶级网格边距属性,因为它可能会指定XAML解析器,您希望Grid占用ItemTemplate中的所有空间。