WP7 Silverlight 应用程序可扩展性 [英] WP7 Silverlight App Scalability Scalability

查看:29
本文介绍了WP7 Silverlight 应用程序可扩展性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在编写一些需要绝对大小的 WP7 应用程序,具体取决于显示设备.这意味着应用程序大小需要为 656 (w) x 480 (h),这对于同时具有 shell:SystemTray.IsVisible="True"shell:ApplicationBar 的 WP7 来说是完美的IsVisible="True".从可能的 800 x 480 开始,使用的两个条形都占用 144,所以我在这方面做得很好.

I'm writing a number of WP7 apps right now that need absolute sizing, depending on display device. What this means that the app size needs to be 656 (w) by 480 (h), which is perfect for WP7 with both shell:SystemTray.IsVisible="True" and shell:ApplicationBar IsVisible="True". From a possible 800 x 480, both those bars used take 144, so I'm good on that front.

在 PC 上,我会使用该尺寸所需的更大版本,例如 720x540.

On a PC, I'd use a larger version of that size need, like 720x540.

然而,如果 iPhone->iPad 是 MSFT 可能的收入来源的任何迹象(以及鲍尔默重新投资平板电脑业务),我将假设我们将看到平板电脑大小WP7 操作系统很快就会推出.

However, if iPhone->iPad is any indication of possible revenue streams for MSFT (as well as Ballmer re-investing in the tablet business), I'm going to make the assumption that we'll see a tablet-sized unit come out soon enough for the WP7 OS.

另外,可能会有 400x240 分辨率的 WP7 出来.

Also, there may be a 400x240 resolution of WP7 to come out.

我希望我的应用能够立即适用于不同尺寸的设备,基于上述尺寸(656 (w) x 480 (h),或它的缩放版本)——而不仅仅是更改一组值以重新发布应用程序.注意:我不使用 - 我不能.应用中的每一件事都是绝对定位的,这是故意的.

What I'd like is for my apps to be immediately available to different sized devices, based on those dimensions above (656 (w) by 480 (h), or a scaled version of that) - rather than having to just change a single set of values to re-release an app. Note: I don't use a <Grid/> or <StackPanel/> - and I can't. Every single thing in the app is absolutely positioned and this is on purpose.

所以这里的问题是 - 是否有一些关于运行我的应用程序的设备的屏幕分辨率大小的值可以阅读?我已经浏览了 参考,但找不到类似的内容.>

So the question here is - is there some value that I can read about the screen resolution size of the device my app is running on? I've looked through the reference, but couldn't find anything like this.

推荐答案

您可以通过以下方式确定可用的显示尺寸:-

You can determine the available display size with:-

var width = Application.Current.Host.Content.ActualWidth;
var height = Application.Current.Host.Content.ActualHeight;

不管方向如何,这些都保持不变.使用 RootVisual 的尺寸也可能会起作用,但如果出于奇怪的原因 RootVisual 具有固定大小,那么这将不起作用.

These remain the same despite the orientation. Using the dimensions of the RootVisual would probably work as well but if for bizare reason the RootVisual has a fixed size then that won't work.

上面的 ActualWidthActualHeight 属性专门用于通知应用程序主机设备提供的视口大小.

The ActualWidth and ActualHeight properties above are designed specifically to inform the application of the size of viewport being provided by the host device.

这篇关于WP7 Silverlight 应用程序可扩展性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆