Smaller PanoramaItems in a Windows Phone 7 app - silverlight

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.

Related

Implementing a fixed size virtual UI card

I am trying to implement a virtual UI ID card that would look like a card on all devices. I will need 4 rows total and 3 columns. I also would like to have the width about twice the size of the height (2:1 ratio).
1) I considered the border layout. but it seems like it spans the whole screen size. Quickly the size of my card width was like 5 times the size of the height. So that did not visually work. I suspect the Gridlayout would suffer from similar issues.
2) I used the table layout (4 X 3). I tried using padding / margin and it seems like the look & feel of the card UI quickly gets out of proportion on tablets while looking decent on phones since phones seem to naturally have a similar width to a card.
3)I tried specifying widthPercentage as a constraint on the table UI. Again this approach sufferred from similar issues. Since on smaller phones I would have to remove add small percentage margins but on big tablets I may need bigger margins. This can get quickly challenging to get right / test.
I am thinking now of attempting to take one of the following approaches:
1) I am not sure if there is a way to specify the TextField width based on the number of characters. For example when the card issue date grows on tablet it can fit 10s of characters where I want it to fit only couple for moht(mm) and 4 chars for year(yyyy). Is there a way to do that?
2) Can I tell the screen width in inches or mm ? I can implement a function to attempt and scale padding / margins on different screen size.
I appreciate any feedback.
See the Kitchen Sink demo which has the default "cards" mode in the start. It uses grid layout with special cases to fit the columns in a sensible way for Tablets/Desktops.
https://www.codenameone.com/demos-KitchenSink.html

Set minimum size of control so all childs fit in WPF

Is there a way in wpf to get a panel or other controls to resize only until overlap/clipping of it's childcontrols would happen.
Example: a Horizon StackPanel with 2 controls of size 100 could be no smaller then 200 wide.
I'm looking for an easy way to do this and hope wpf supports this, because it seems a pretty common thing to ask.
If you're gonna provide an answer that tells me to go over all the children and measure them. Please give directions how to take margin into account.
Thanks
EDIT:
without hardcoding it yourself

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!

How can I re-size controls based on resolution?

Inside a WinForms application what is the best way to handle re-sizing controls to match based on screen resolution and maximizing and re-sizing the window. I have 3 columns that are set like this. LABEL TEXTBOX in each column. You could count that as 6 columns. I have tried anchoring to the right but the problem there is the textbox in column 1will overlap the next 2 columns. I have also tried docking but that does not seem to do the trick. Is there any easy way of doing this?
TL;DR: You can't without manually coding resizing logic. As a side note, you probably shouldn't be trying to do this.
In traditional WinForms there is no automatic way to my knowledge without rolling your own solution. Sean87 suggested the AutoScaleMode property, but while it is then automatic it doesn't support auto-sizing by resolution. It gives an option for scaling based on Font size settings in Windows or the DPI setting. Neither of these are directly changed when simply changing the screen resolution and, honestly, most typical users (and even probably power users) probably never modify the DPI or font size settings.
Besides, the whole point, from a basic user perspective, of increasing screen resolution is to give more virtual desktop "space" to place application windows in. True, most monitors are LCD-based now and thus have native resolutions that make changing this around mostly a thing of the CRT past. But still, the act of buying a new, larger monitor would let a typical user increase this virtual screen space so that they could see more windows on the screen simultaneously. An application that always maintains the same relative size to the screen resolution would be quite uncommon I think and goes against the expectations of most users, including even us advanced developer users.
Typically, you are to code your application to adjust its contents intelligently and usefully if the window is resized, but generally you defer to the user for managing that as it is their machine and their preference (think of it as the "my house, my rules" principle). This is also why most (all?) applications don't change window positions except when directly manipulated by the user (via dragging the window frame and such). In fact, all of this likely explains why Microsoft chose not to include any automatic sizing rule based on resolution.
You don't define what you mean by "column". Generally, you should use a TableLayoutPanel and inside each "cell", set the anchors of the controls.
you can change AutoScaleMode of the form and also auto size property of each control. And you might use splitcontainer or panels to form your columns.

Silverlight 3: Techniques for adjusting to screen resolution

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.

Resources