Silverlight 3: Techniques for adjusting to screen resolution - silverlight

My developer's box has a screen resolution of 1680 x 1050. I'm developing a full-screen Silverlight 3 application that I'm considering deploying to the Internet. So, I want to make sure the application looks good on a variety of screen resolutions. I just started testing on other boxes, the first one having a screen resolution of 1024 x 768. During the test I found some of the pages on the application were partially truncated. It seems the controls on the page didn't adjust for the lower screen resolution. So, I'm looking for some tips on how to make a Silverlight application, to the extent possible, adjust for screen resolution. For example, are there things one should or should not do on XAML to make adapting to screen resolution easier? Should I just optimize for a minimum screen resolution? Your thoughts and suggestions are welcomed.

You can easily enforce a minimum acceptable resolution by setting the MinHeight and MinWidth properties of your root visual. (Of course, this should be less than the minimum screen resolution to account for browser chrome.)
Try to specify absolute Width and Height only when necessary: for example, for images or icons of fixed dimensions, or for obvious cases like TextBoxes (whose width should reflect the average length of the data entered).
Grid panels are excellent for mixing scalable and fixed layout areas. The star sizing specification takes a bit of getting used to--it's not as simple as a percentage-based proportioning--but it's much more flexible, especially in combination with row/column min/max dimensions.
You don't really need to test on multiple resolutions unless you're interested in testing a range of dots per inch--just resize the browser to approximate different screens. Since there's always a bit of give and take depending on the user's browser configuration, you'll have to account for some variance anyway.

You can make your application scale with the Silverlight Toolkit ViewBox or make it strech with layout controls like the Grid, StackPanel, and WrapPanel. Make your main UserControl have a Width and Height of Auto (or remove the width and height entirely) and the size of the app will resize to the size of the parent div (the default HTML template uses 100%x100%). Then just resize the browser accordingly. IE8 has developer tools that can help you see your app resized to specific screen resolutions.
Testing on a variety of screen resolutions is always a good idea.

I covered the resizing of elements and making it resolution independent on another thread.
You can have a look here, there are multiple ways to sizing and resizing things automatically.

Related

How to properly use screen size in WPF application

I've done desktop application's GUI for minimum 800x600 pixels. But now I need to make it look good when maximised in any screen size. There is so little to show, I don't know how to adjust the elements in big screen.
Now in 800x600:
Maximised in 1366x768:
I tried to make them bigger with screen size, but that give them kinda ugly, unsophisticated look. What should I do?
You need to use WPF Grid Layout to position your control. It will stretch the size of your control based on the defined layout.
You can read a tutorial here https://www.wpftutorial.net/GridLayout.html
You can use Uniform grid in that case
http://www.c-sharpcorner.com/uploadfile/raj1979/uniformgrid-in-wpf/

Responsive Design with 100% width

I've been researching responsive design recently and had the thought why not use a flow layout instead of something like a 960 grid? From my research, 960 was chosen to fit the most popular monitor size. But on larger or wide screen monitors, there is still a lot of empty space.
The thought I had is shouldn't the largest size for media query be 100% page width? Instead of 960 px?
Can anyone explain why this isn't the norm, or why people default to a fixed width for responsive design?
If you want to use widths wider than 960px, then the Bootstrap grid is one option, so you don't need to reinvent the wheel.
Bootstrap 3 is in the process of being released and while the grid classes have changed you can still get responsive full page layouts or responsive layouts with a max width of 1200px
An example of a full page grid
An example of a max 1200px grid
Foudation used to have max grid options around 1100px though as far as I can tell, out of the box with Foundation 4 the max is now around 1000px. It should be easy enough to change this though by using a custom setting for the width of the .row class
As for your question
The thought I had is shouldn't the largest size for media query be 100% page width? Instead of 960 px?
as #cale_b noted, readability could be an issue with full width layouts unless you are carefull with typography and font sizes. I think it is certainly doable if you are careful with the design though.
It will depend on the site design.
Good luck!

iOS controls on iPad specific screen sizes

I have a fundamental question that I would like to get addressed. I'm almost done with my universal app and I was told that I need to specifically customize the UI controls for iPad screens (e.g) labels, buttons. So, for example, I have the following code in viewDidLoad event in one of my xibs.
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
[_lblRandomDisplay setFont: [UIFont fontWithName: #"Helvetica Neue" size:100]];
}
else
{
[_lblRandomDisplay setFont: [UIFont fontWithName: #"Helvetica Neue" size:250]];
}
Here _lblRandomDisplay is UILabel IBOutlet property and I increase the font for iPad and reduce it for iPhone. Is this the way to approach the iPad screens or does iOS automatically scale the screen when viewed on iPad?. As a side note, I have named the xib filenames as filename~iphone.xib and filename~ipad.xib and it loads correctly based on the device selected in the simulator.
In those lines, I have a Settings screen (not using the Settings bundle) using UITableViews that I have designed for iPhone and programmatically load data from NSArray. When loaded on iPad using the settings~ipad.xib (copied the controls from settings~iphone.xib), I haven't adjusted the row height specifically for iPad to make it look bigger. The screen shows OK on the iPad but it looks smaller. Is this the right approach or what is the best way to approach this?
Please advise.
The advice that you have been given, to customise UIControls for screen size, seems wrong. UIControl sizes, and text sizes in general, should remain the same on all devices. These items are designed in sizes appropriate for readability and touchability, neither of which has any relationship to screen size.
iOS is designed with this in mind. If you make a universal project with iPad and iPhone xibs or storyboards, you will find that user interface widgets are the same pixel/point size regardless of the device (I am ignoring Retina/non-retina distinctions here for simplicity). For example, the default size of a standard button is 73 x 43 with a font size of 15pt in both cases. A Navigation Bar is 44 px/points high on both devices. This is as it should be. If we assume that reading distance on an iPhone, or an iPad mini, or an iPad is approximately the same, then there is no reason to adjust text size. The idea of redesigning for the iPad is really that you can get more information on one screen, not a bigger version of the same information.
There are two circumstances in which iOS "scales the screen":
is if you create an iPhone-only app and run it on an iPad. Then there is a user option to run it at double size. In this case everything including font sizes are scaled up, but this is done by pixel-doubling, so the effect is a big blur. Take a look at it - and you will understand that this is precisely the reason why you should not design in this way.
if you use a single xib/storyboard for both iPhone and iPad, and rely on autolayout (ios6+) or autoresizing masks (ios5-) to auto-adjust the layout for different screen sizes. This method can -depending on your settings - proportionally resize image content of views, but will not dynamically resize text content, if you wanted to do that you would have to adjust in code. This is not a good way of designing an app anyway, it is better to make a dedicated design for iPhone and for iPad in separate xib/storyboards as you have done.
I expect when you say the iPad "looks smaller" you mean, the UI appears smaller as it gets lost on the larger screen... but the answer is not to just enlarge the size of your data, it is to reconsider your layout to fit more data on each screen. That is why with the iPad Apple provided the SplitViewController and introduced the pattern of the Container ViewController.
I wonder if you are also raising a related, but separate issue of proportional sizing of views for graphic design purposes (you mention font sizes of 100 and 250pt, not usual sizes for UI controls labels). You may want the look of your app to scale with the screen, a bit like the so-called fluid web design approach to variable window sizes. So for example you may have a graphic device based on a huge letter 'A' that fills your iphone screen, and want that letter to similarly fill you ipad screen. In this case you may need to set font sizes as in your code example.
You are certainly doing the right thing by not altering the row height of your table cells for the different devices, but for the larger screen you can of course make your table height larger, and accomodate more table cells in your view.
All of these comments are a bit general, as you haven't posted enough detail of your problem. It often helps to post a picture or two...

Smaller PanoramaItems in a Windows Phone 7 app

Is it possible to decrease the default width of a Panorama control's PanoramaItems?
They can be made wider by specifying Orientation="Horizontal" and a width larger than 432. However, specifying a width less than 432 does not result in a smaller PanoramaItem. It's minimum width is 432 always.
I played around with the templates but couldn't figure out how to achieve this.
I'm afraid there isn't anything you can do about that. The Panorama has the width of its items baked in as 48 pixels less that its own width.
PanoramaItems are not designed to have a smaller width. If you wanted to do this you'd probably need to create your own version of the Panorama control.
Don't do this though!
Not only would it be a lot of effort to get right you'd break user expectations about how the panorama would work.
Would/could you allow multiple items to be displayed at once?
What would be the impact on navigation?
How would you communicate to users that your app works slightly differently to all the other ones on the phone?
How would you justify the mental cost to the user of the different behaviour?
What would the impact be on the item headers if they were smaller?
With the PanoramaItem width set to at least (almost) the width of the screen it allows the user to see and focus on a single item at a time.
Also, potentially having fewer items on screen at once can also help with performance too.

WPF, any easy way to work with different screen resolutions?

Given a WPF Application running full screen, a fair amount of controls some of which will animate from off screen to center. I was wondering if there are any special ways to save on the amount of time required to optimize an application for different screen resolutions?
For example, using Blend I've setup some text, which is originally off screen to scroll into view. Now in design mode the start positions are static. If resolution changes the start positions will obviously not be correct.
So I guess to correct this, during app startup. I need to
Check resolution
Move the text box to the desired start location
Adjust the storyboard as required, so the frames all have correct co-ordinates depending on the res of the screen.
I don't mind doing all of this, but if there is an easier way please share!
Thanks
In WPF layout of controls should be made in such way, that when size of window or content changes, controls automaticaly resize/reposition themselves to reflect this change.
This is highly affected how your layout is made, especialy by using specific panels, that do layout of their child elements.
This is also made obvious by using device-independent units for sizes, margins and sometimes positions of controls. And also allows different kind of zooming and scaling of whole UI without any need to redesign the whole thing.
If you are trying to position your controls absolutely, either by using Canvas panel or margins, your are doing it totaly wrong.
In WPF, scene is measured in abstract units, not pixels, and controls are freely scaled. There should be no problems to center something, or what?

Resources