WP7 全屏显示图像

发布于 2025-01-05 08:19:59 字数 1829 浏览 2 评论 0原文

我正在开发一个应用程序,我想在其中浏览图像,例如本机 WindowsPhone 表单。

我用过枢轴控制。一切正常,但有一件不想要的事情。图像未填满所有显示区域。页面顶部有一个间隙。我在任何可能的地方都设置了边距和填充。结果还是一样。 :(

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>

I am developing an application where i want to browse images like native WindowsPhone form.

I have used Pivot control. Everything works, but there is one unwanted thing. The image does not fill all display area. There is a gap on the top of page. I have set margin and padding everywhere where it is possible. And the result is still the same. :(

Captured example

Here is my XAML code:

<!--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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最近可好 2025-01-12 08:19:59

你说的是系统托盘吗?
要删除系统托盘,请使用以下代码:

shell:SystemTray.IsVisible="False"

更新:

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

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

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

Are you talking about the system tray?
To remove the system tray use the following code:

shell:SystemTray.IsVisible="False"

Update:

I'm not real sure why that extra space is there.
I created a simplified version of your example and the only thing I could think of is to use negative margins. There is probably a better solution that I am just overlooking, but for now you can just use the following:

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

Although, from your posted image, it looks as if you have a bigger gap than I did, so you might need to decrease the margin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文