我在 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/