2012-02-11 75 views
2

我正在开发一个应用程序,我想要像本地WindowsPhone窗体一样浏览图像。WP7在整个显示中的图像

我已经使用了枢轴控制。一切正常,但有一件不必要的事情。图像不会填满所有显示区域。页面顶部有空白。我已经在可能的地方设置了边距和填充。结果仍然是一样的。 :(

Captured example

这里是我的XAML代码:

<!--LayoutRoot is the root grid where all page content is placed--> 
<Grid 
    x:Name="LayoutRoot" 
    Background="Transparent" 
    Margin="0"> 
    <toolkit:PerformanceProgressBar 
     VerticalAlignment="Top" 
     HorizontalAlignment="Left" 
     IsIndeterminate="{Binding IsBusy}" 
     Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibilityConverter}}"    
     /> 

    <controls:Pivot 
     x:Name="PhotoPivot" 
     ScrollViewer.HorizontalScrollBarVisibility="Auto" 
     IsHitTestVisible="True" 
     ItemsSource="{Binding Photos}" 
     Margin="0" 
     Padding="0"     
     > 
     <controls:Pivot.HeaderTemplate>    
      <DataTemplate/> 
     </controls:Pivot.HeaderTemplate> 

     <controls:Pivot.ItemTemplate> 
      <DataTemplate > 
       <controls:PivotItem 
        x:Name="PhotoPivotItem" 
        Margin="0"       
        > 
        <Image 
         x:Name="PhotoPicture" 
         Source="{Binding}" 
         Stretch="Uniform" 
         HorizontalAlignment="Stretch" 
         VerticalAlignment="Stretch" 
         Margin="0" 
         /> 
       </controls:PivotItem> 
      </DataTemplate> 
     </controls:Pivot.ItemTemplate> 

    </controls:Pivot> 
</Grid> 

回答

1

你说的是系统托盘 要删除系统盘使用下面的代码:

shell:SystemTray.IsVisible="False" 

更新:

我不确定为什么会有额外的空间。 我创建了您的示例的简化版本,我唯一能想到的就是使用负边距。有可能是一个更好的解决方案,我只是远眺,但现在你可以使用以下命令:

<controls:PivotItem x:Name="PhotoPivotItem" Margin="0,-10,0,0"> 

虽然,从您发布的图像,它看起来好像你比我更大的差距,所以您可能需要减少边距。

+0

我不是。我已经删除了系统托盘。但仍有一定的未使用的空间..(在图像的顶部) – 2012-02-13 12:30:55

+0

看到我的更新。我认为它应该解决这个问题。 – 2012-02-14 03:46:14

+0

负边界正在工作。正如你预测的那样,差距更大。 – 2012-02-14 08:57:19