1. Obtain the screen range:
Method 1:
Frameworkelement element = application. Current. rootvisual as frameworkelement;
If (element = NULL)
{
Return;
}
Double width = element. actualwidth;
Double Height = element. actualheight;
Or
Method 2:
Double width = application. Current. Host. content. actualwidth;
Double Height = application. Current. Host. content. actualheight;
Note: (verify it on the wp7.1sdk simulator)
Method 1: When this method is called in the app constructor, the obtained data is 0. In this case, the rootvisual object has a value, but an exception occurs when it is called in the mainpage constructor, the rootvisual object is empty. In the key event in mainpage (applicationiconbutton corresponds to the click event here), or in the constructor of the new page, this method can get the specific value.
The results returned by methods 1 and 2 are (480,800), regardless of whether systemtray (status bar), ApplicationBar, or portrait or landscape exists.
Note: S
In portrait mode, systemtray occupies 32 pixels, ApplicationBar occupies 72 pixels, and SIP occupies 339 pixels (62 pixels is added when Lenovo words appear ),
In portrait mode, both systemtray and ApplicationBar occupy 72 pixels, while sip occupies 259 pixels (62 pixels is added when Lenovo words appear ),
2. inputscope attributes of textbox:
CS file:
Inputscope = new inputscope ();
Inputscope. Names. Add (New inputscopename {namevalue = inputscopenamevalue. url });
This. textbox. inputscope = inputscope;
In the XAML file:
If you do not know the value of inputscope, you can use this method to obtain the prompt:
<Textbox X: Name = "textbox">
<Textbox. inputscope>
<Inputscope>
<Inputscope. Names>
<Inputscopename namvevalue = "url"/>
</Inputscope. Names>
</Inputscope>
</Textbox. inputscope>
</Textbox>
When you know the specific value of inputscope, you can:
<Textbox X: Name = "textbox" inputscope = "url"/>