Windows Phone 7 Study Notes (1)

Source: Internet
Author: User

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"/>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.