How to set the brightness of the screen on WP7 - xna

How to set the brightness of the screen on WP7 to its maximum using silverlight/xna?
<Canvas x:Name="light" Background="White" Width="480" Height="800" />
I used this code .Have any other way?

You can't set the brightness from a 3rd party application. There's no public API for this.

Related

Reducing the size of UISwitch in Xamarin Forms does not work

In Xamarin Forms, I created a custom renderer for Switch. On iOS, I updated the scale transform to make it smaller than its default size:
Control.Transform = CGAffineTransform.MakeScale((float)0.75, (float)0.75);
While this successfully resizes the Switch, it doesn't resize its bounding box. How can I resize it as well?
Here the background color of the Switch is set to red in XAML. It looks like the original bounds are still being maintained even though the thumb is smaller.
You can use the Scale property of Switch in Xamarin.Forms:
<Switch OnColor="Orange" Scale="0.75" BackgroundColor="Red"
ThumbColor="Green" />

How to trigger image CSS #media on zoom event (iOS)?

I thought that CSS #media query will work with pinch-zoom on iOS devices this way - user zoom an image and since the "area" become larger #media "replace" this image with larger(hq) one if it is present in a code (spoiler: I was wrong).
So, I start implementing it, code example:
<picture>
<source media="(max-width: 300px) and (orientation: portrait)" srcset="/image_1_1.png 1x, /image_1_2.png 2x, image_1_3.png 3x" />
<source media="(max-width: 500px) and (orientation: landscape)" srcset="/image_2_1.png 1x, /image_2_2.png 2x, image_2_3.png 3x" />
</picture>
I have a hi-res images on my site, and I simply cover all main screen size same way as in example above to reduce the load on devices with smaller screen, but when I tried to zoom in on it on iOS device nothing is happened, the image is just became lower in quality, no large one is replacing this smaller one.
I want to reduce the load time and bandwidth on devices which has no need in HQ graphics on page load, but if users want to take a closer look on images (zoom) they be provided with HQ copy of zoomed image.
How it can be done? (iOS compatible, pure CSS only)
//Yes, I saw other topics on this subject and in some of them I noticed that #media rules have to be applied automatically when zoom event occurs, but as I explained above, not in my case (addressing possible duplicate question mark).

Jquery Mobile - Density Independent Pixels

I am developing an android app in PhoneGap . I have to adjust some button sizes as per the screen size on which the app is run .In android we have sp , dpi .Are there any similar type in jquery mobile.
I only caught a glimpse of jquery-mobile, as far as I know it does not directly address variable display sizes and pixel densities.
There are other mechanisms to handle this:
Set the viewport's target-densitydpi to medium-dpi (=160dpi). This virtualizes the px unit, e.g. 1px in html/css then corresponds to 2 physical pixels on a 320dpi device. Easy solution, but note that images are scaled as well.
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=medium-dpi" />
CSS: Use media queries to implement conditional styling. Adapting for different screen sizes dependent on width, height, aspect or orientation is straight-forward, see http://www.w3.org/TR/css3-mediaqueries/.
Different pixel densities can be handled with device-pixel-ratio (thanks to Marc Edwards for providing an example: https://gist.github.com/marcedwards/3446599).
#media screen and (-webkit-min-device-pixel-ratio: 1.5),
screen and (-o-min-device-pixel-ratio: 15/10)
{
body { background-image: ... } /* provide high-res image */
}
The media feature resolution is cleaner than device-pixel-ratio, but many browsers don't support it.
Use Javascript: Adapt button sizes, images etc. based on window.devicePixelRatio and window.screen.width and window.screen.height. Layouting per Javascript is considered as bad practice. Also flickering might result during loading as the execution starts after the pageload event.

Dart: determining the size (innerWidth) of a img tag

I am developing a simple polymer dart application and I have a polymer tag containing an image tag
<polymer-element name="picasa-photo">
<template>
<img src="{{imageUrl}}" width="100%">
</template>
<script type="application/dart" src="picasaphoto.dart"></script>
</polymer-element>
The width is set to 100% so that the image will resize when the user resizes the browser.
At regular intervals I change the {{imageUrl}} property to download a photo from google's picassa web site. The picassa web site API allows me to specify the resolution of the image that is downloaded and I would like to match it to the current size of the image. For example, if the user makes the browser very large, then I would like to download a high resolution image. Likewise if the browser is very small, I can get Picasso to download a small image.
My question is, how can I determine the actual size of the image tag?
Of course you have control about the tags id. The only difference is, that the id of the img tag is only valid inside the custom element. You can use shadowRoot.querySelector('#id').innerWidth; or the shortcut $['id'].innerWidth;
It's also possible to access it from outside your custom element with document.querySelector('#custElmId).shadowRoot.querySelector('#id').innerWidth;`

How to set a opacity in textbox for background and foreground color in windows phone 7.1?

I want to set a opacity in textbox in windows phone 7.1. I want to set opacity 20% for the background with #503E28 color code and 50% for foreground with #3B2D1E color code in the textbox in windows phone 7.1.
Try adding the alpha channel into the colour code
<TextBox Foreground="#803B2D1E"
Background ="#33503E28" ... />
I believe WP uses ARGB values, so the first value is A (alpha). Alternatively, you can style it using Expression Blend.

Resources