.net - Windows Phone 8 全屏页面

标签 .net windows-phone-7 xaml windows-phone-8 winrt-xaml

我在 Windows Phone 8 的 XAML 中定义了以下页面

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

网格定义了应用于整个屏幕的白色背景,但是网格的内容并不靠近窗口边缘,图像和窗口边缘之间存在可观察到的边距/填充。 如何确保图像直接紧靠窗口边缘

最佳答案

尝试设置图像Stretch属性:

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

有关更多信息,请参阅MSDN pages regarding image stretching .

此外,您的按钮将在图像周围添加一些“填充”。为了避免这种情况,您必须更改其模板。我会将模板替换为仅呈现内容的模板:

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

不过,如果您完全删除“chrome”按钮,您也可以直接使用图像并处理图像上的点击/单击事件。

关于.net - Windows Phone 8 全屏页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15386700/

相关文章:

silverlight - XAML 如何在图像上 float 文本

c# - 在 UWP 中设置密码框的对齐方式

xaml - 发布预览 : Can not find a resource with the Name/Key FocusVisualWhiteStrokeBrush

c# - 在哪里捕获异步 WCF 调用的 EndpointNotFoundException?

c# - 如何汇总列表框列中的所有值并将其显示在文本 block 中?

c# - JIT 内联是否可以将我的代码内联到某些 .NET 运行时汇编代码中?

.net - Log4Net EventLogAppender 未记录到自定义事件日志

c# - 在 C# 中进行 Windows Phone 开发的 Intent

.net - 在程序集加载时执行代码

c# - 如果 XElement 上不存在 XAttribute 默认值