的Windows Phone 8全屏页面全屏、页面、Windows、Phone

2023-09-05 04:03:49 作者:哼唱爱情。

我在XAML为Windows Phone规定的下列第8页

I have the following page defined in XAML for Windows Phone 8

<phone:PhoneApplicationPage x:Class="MangaRack.View.Phone.View.ChapterView"
    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"
    shell:SystemTray.IsVisible="False">
    <Grid Background="White">
        <Button BorderThickness="0" Name="ImageButton" Padding="0">
            <Image Name="Image" />
        </Button>
    </Grid>
</phone:PhoneApplicationPage>

网格定义了被施加在整个屏幕上的白色背景,但是网格的内容不是在窗口的边缘附近,有图像和窗口的边缘之间可观察到的余量/填充。 我怎么能保证图像是直接靠在车窗边

推荐答案

尝试设置你的形象拉伸属性:

Try setting your image Stretch property:

<Image Name="Image" Stretch="UniformToFill"/>

有关详细信息,请参见 MSDN网页有关图像拉伸。

For more information see the MSDN pages regarding image stretching.

另外,你的按钮会增加一些填充在你的形象。为了避免这种情况,你将不得不改变它的模板。我将取代模板与其中一个简单的呈现内容:

Also, your button will add some 'padding' around your image. To avoid this, you will have to change its template. I would replace the template with one which simply renders the content:

     <Button>
         <Button.Template>
            <ControlTemplate TargetType="Button">
                <StackPanel x:Name="stackPanel" Orientation="Horizontal">
                    <ContentPresenter VerticalAlignment="Bottom"/>
                </StackPanel>
            </ControlTemplate>
         </Button.Template>
        <Image Name="Image" Stretch="UniformToFill"/>
      </Button>

尽管如此,如果你是完全删除按钮铬你可能也只是直接使用图像和处理自来水/点击图片上的事件。

Although, if you are entirely removing the button 'chrome' you may as well just use the image directly and handle tap / click events on the image.