简体   繁体   中英

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.

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

On Experts-Exchange a member wrote that this is a common problem in Silverlight - which i definitely do not believe.

I would agree that this is a common problem with 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. I haven't used it, but I believe one of the Developer Toolkits had a StackGrid, or something like that. 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. 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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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