简体   繁体   English

Silverlight 4控件

[英]Silverlight 4 Controls

I have a problem with Silverlight 4. The problem is that i am developing on a 24" monitor screen. When i get home from work i continue to develop on my laptop which only has 19" monitor screen. 我对Silverlight 4有问题。问题是我正在使用24英寸显示器屏幕进行开发。下班回家后,我将继续在只有19英寸显示器屏幕的笔记本电脑上进行开发。

And what really irretates me is that the controls is not where i want them to be. 真正让我烦恼的是,控件并不是我想要的控件。

The controls are added upon each other. 控件彼此添加。 I am using simple controls like Buttons, textboxes etc. 我正在使用简单的控件,例如按钮,文本框等。

I do also have the controls within a Grid.Row and a Grid.Column. 我在Grid.Row和Grid.Column中也有控件。 I have tried with StackPanels also inside the grid and in the Columns etc. Also tried to have Stackpanel and a Grid inside, and i also tried with Canvas. 我尝试过在网格内部和列等中使用StackPanels。还尝试在内部使用Stackpanel和Grid,我也尝试过使用Canvas。

On Experts-Exchange a member wrote that this is a common problem in Silverlight - which i definitely do not believe. 在Experts-Exchange上,一位成员写道,这是Silverlight中的常见问题-我绝对不相信。

I would agree that this is a common problem with Silverlight. 我同意这是Silverlight的常见问题。 It isn't that it isn't possible to get it right, but sometimes getting all of the controls to line up properly using different resolutions can be a challenge. 并非不可能做到正确,但有时使用不同的分辨率使所有控件正确对齐可能是一个挑战。 Often a challenge that developers just don't take the time to solve. 开发人员常常不花时间解决挑战。

For me it just comes down to trial and error with regards to setting row and column width/heights to Auto, *, and fixed and then combining this with StackPanels and ScrollViewers. 对我而言,它只是关于将行和列的宽度/高度设置为“自动”,“ *”并固定然后将其与StackPanels和ScrollViewers结合使用的反复试验。 I haven't used it, but I believe one of the Developer Toolkits had a StackGrid, or something like that. 我没有使用过它,但我相信其中一个开发人员工具包具有StackGrid或类似的东西。 It combined the functionality of stackpanels and grids into a single control. 它将堆栈面板和网格的功能组合到一个控件中。 I've heard others claim that using that control made things easier. 我听说其他人声称使用该控件会使事情变得更容易。

Pay attention to Vertical/Horizontal Alignment and Margins to help position the controls too. 注意垂直/水平对齐和边距,以帮助放置控件。

When developing for multiple resolutions, use the design size handles to keep re-sizing your interface. 当开发多种分辨率时,请使用设计尺寸手柄来调整界面的大小。

If the interface just cannot go below a certain size, set that as the MinHeight/MinWidth and place it all in a scrollviewer. 如果界面不能小于某个特定大小,请将其设置为MinHeight / MinWidth并将其全部放置在scrollviewer中。 That way scrollbars will simply kick in if the screen gets too small to be usable for your design. 这样,如果屏幕太小而无法用于您的设计,滚动条将简单地插入。

Silverlight grids are a lot like HTML tables in that you need to flex them about a lot to ensure you have correctly linked to the right edges/positions. Silverlight网格与HTML表格非常相似,您需要对其进行大量调整以确保正确链接到正确的边缘/位置。 Silverlight has more options (thanks to stretch etc) and it just takes practice to learn how to nest the boxing model to do what you want. Silverlight有更多选择(感谢拉伸等),只需要练习就可以了解如何嵌套拳击模型以完成您想要的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM