[Translation] WP7 Quickstart-Article 4-different types of controls

Source: Internet
Author: User

Address: http://create.msdn.com/en-US/education/quickstarts/Types_of_Controls

Note: This articleArticleIt is the fourth article translated from Microsoft's official WP7 Quickstart, which describes the different types of controls in WP. Some of the content is added to your understanding and expression habits. The main purpose of this series is to practice English, and to give yourself an understanding of WP7 development as a bi developer. For some improper translations, I hope you will point out criticism and correction]

Windows Phone SilverlightProgramControls are divided into different types. Some controls also appear in traditional Silverlight, but some are unique to Windows Phone. This article describes these different types of controls and how to use them.

This part contains the following parts:

Navigation controls

Layout and grouping controls

Text Control

Button and Selection Control

List controls

Images, maps, and media controls

HTML Control

Progress and message control

Toolkit Control

Navigation controls

The Windows Phone application of Silverlight is based on a page model that allows users to navigate back and forth between different page content. This model is based on the frame control, and the navigation between pages depends on it.

The following table lists the controls used by the Windows Phone program to support navigation.

Phoneapplicationframe

The main control of the Windows Phone Silverlight program. Used to support page navigation.

Phoneapplicationpage

Controls that can be navigated by phoneapplicationframe.

The frame and page model are displayed.

Layout and grouping controls

A Layout control is a control that can contain other controls, including other controls and some visual elements. Like its name, it is used to locate the position of its internal control. A Layout control is usually used in the root layout of a page in a program. All other controls are contained under this root control. If necessary, you can also add other layout controls to the root layout control. When you create a Windows Phone program, a grid is created as the root element of the layout. This control contains other layout controls for displaying titles and content. You can also add layout controls in the content section. However, when selecting the specific layout control, you also need to consider whether the program must support horizontal screen switching.

Most layout controls inherit from panel classes, such as stackpanel, canvas, and grid. The other two controls are panorama and runtime, which are inherited from itemscontrol and have special purposes in the Windows Phone program, which is quite different from other list controls, compared with traditional list controls, a large number of elements can be contained, and they should contain a small number of elements as much as possible. They are mainly used to switch back and forth between different list elements.

The layout and grouping controls in the Windows Phone program are listed below.

Border

Draws a border or background color around another element.

Canvas

The controls are displayed in coordinates.

Contentcontrol

The rendering container of a single element. This element can be a class, so it can also contain other child elements.

Grid

Locate the elements based on the row and column information. You can define several rows and columns in the grid, and then specify which row and column the element is placed in.

Panorama

Panoramic View, internal elements can be switched on one screen

Bytes

This control can be used as a navigation interface for switching or filtering data in different views, providing a convenient way to manage grouped data.

Stackpanel

Presents elements in a linear manner and supports horizontal and vertical la S.

Virtualizingstackpanel

Compared with stackpanel, it provides better processing performance for a large amount of element data.

Scrollviewer

Provides a scroll bar to display internal elements.

The display controls use stackpanel, canvas, and grid in different la S and vertical la S.

Displays how the panorama control displays the horizontally switched content.

Text Control

A text control is usually used to display the content of a string. There are different types of text controls based on different methods. The following table lists text controls in Windows Phone programs.

Textblock

It is used to display simple read-only text.

Textbox

Used for short text input. You can also input large text and multiple lines.

Passwordbox

Used to enter the password. The entered password is replaced with the * symbol.

Demonstrate basic text controls.

Button and Selection Control

Buttons and selection controls allow you to easily select and navigate in the program. Most buttons and selection controls inherit from contentcontrol, that is, the content is the content attribute. The type of this attribute is object, so their content is limited a lot, because many controls inherit from the object type, so that you can create controls in contentcontrol in a nested manner. For example, the content attribute of a button can be set to a stackpanel control, which then contains an image and text. Lists All button controls.

Button

The event where the Click Event Response button is pressed.

Hyperlinkbutton

The button is displayed as a hyperlink. When clicked, you can navigate to the page specified by the user.

The following list shows the selection controls.

Checkbox

Check box to mark the user's selection and unselected status.

Radiobutton

A single listener allows you to select one from a bunch of options, usually a group of radiobutton.

Slider

You can use the slider to select a value within a range.

Is an example of a button and a selection control.

List controls

Elements are displayed in the form of a list, mainly including:

ListBox

You can click to select the elements in the list. The content is items and itemssource. Each element can be customized through datatemplate.

Is a list control demonstration.

Images, maps, and media controls

As a Windows Phone client, expressive display, images, maps, and media are very important.

Image

Show images. Use source to specify images. Windows Phone supports images in PNG and jpg formats.

Map

Shows the Bing map. It can be used directly in the toolbar. To use Bing map, you need to obtain a bing map key for your program. Use mode to specify the map display type and zoomlevel to scale.

Mediaelement

Used to play audio and video. Specify the content through the source attribute. However, for performance reasons, it is best to use the soundeffect class of the xNa framework.

Displays images, maps, and media controls.

HtmlWidget

Used to display HTML content in a program. Mainly through webbrowser.

Demonstrate the web page display in the webbrowser control.

Progress and message control

A good program will provide users with better feedback information. For example, you can provide a progress display for a long operation and display the error information in the message box. The following table lists the supported progress and Message Components.

Progressbar

Displays the progress of the current operation, which is used to report the progress of an operation, or specify the progress bar as an uncertain mode. This mode reduces program performance.

Popup

A message box is displayed at the top layer of the interface. Used to temporarily display or prompt some information. Generally, a user space is used as the Child attribute of popup. You can set the isopen attribute of the popup attribute to specify whether it is displayed.

The following shows popup, including textblock, button, and processbar.

ToolkitWidget

More components are provided in the Silverlight for Windows Phone toolkit of codeplex. ContainsSource codeAnd examples. The following table lists the currently contained controls. Toolkit also contains many components, such as page overuse and Gesture Recognition.

Autocompletebox

When you enter text information, a drop-down list component will prompt items that may match according to the currently entered content.

Listpicker

The selected items are displayed in a text box. The selected items are displayed in the drop-down list.

Longlistselector

Displays the large list information in groups.

Contextmenu

Context menu, which appears when you hold down a control for a long event.

Datepicker

Date Selection Control

Timepicker

Event Selection Control

Toggleswitch

Switch Control

Wrappanel

Dynamic Layout is performed based on internal elements in the form of columns. When the element cannot be displayed in the current row, it is automatically displayed in the next row.

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.