[英]Centering an App in WP7
I've chosen Landscape only for my view in 800w x 480h available space. 在800w x 480h的可用空间中,我仅为视图选择了“风景”。 I want my app to be 600 (w) by 240 (h), absolutely sized.
我希望我的应用大小为600(宽)乘240(高)。 (There is a long story as to why this is, but it ain't gonna change - I don't want or need to fill all of the available space and need absolute sizing) .
(关于这是为什么有一个长的故事,但是它不会改变-我不需要或不需要填充所有可用空间,并且需要绝对大小) 。
How can I center the app horizontally and vertically so that is its CenterX/Y is the same as the available space's CenterX/Y. 如何将应用程序水平和垂直居中放置,以便它的CenterX / Y与可用空间的CenterX / Y相同。 I've tried
VerticalAlignment="Center" HorizontalAlignment="Center"
on both <phone:PhoneApplicationPage/>
as well as <Grid/>
and <Canvas/>
tags - none of this works. 我已经在
<phone:PhoneApplicationPage/>
以及<Grid/>
和<Canvas/>
标记上都尝试过VerticalAlignment="Center" HorizontalAlignment="Center"
-这些都不起作用。 Any thoughts on how I be able to center my app on screen? 关于如何在屏幕上居中放置应用程序有任何想法吗?
You could try with margins on the main grid: 您可以尝试在主网格上使用边距:
Margin="100,120"
100 = (800-600)/2 100 =(800-600)/ 2
120 = (480-240)/2 120 =(480-240)/ 2
为什么不使用网格,并在其中将Width =“ 600”和Height =“ 240”的网格嵌套在其中,将HorizontalAlign =“ Center”和VerticalAlign设置为对应的网格呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.