Detailed description of the windowsphone control and reference of the external control Silverlight Toolkit

Source: Internet
Author: User
Tags map class silverlight

++ ++

This article is original on this site. You are welcome to repost it! Reprinted please indicate the source:

Http://blog.csdn.net/mr_raptor/article/details/7229618

++ ++

 

In Silverlight, basically all controls are in the system. Windows namespace.

The inheritance structure of the control is as follows (take the button as an example ):

Address: http://blog.csdn.net/mr_raptor/article/details/7229618

 

Next we will analyze each hierarchy in the inheritance relationship in sequence:

System. Threading. dispatcherobject
All Silverlight objects are derived from dispatcherobject. Silverlight works in the single threading apartment (STA) model. dispatcherobject is mainly responsible for processing concurrent threads and synchronization. When a message occurs, such as a mouse click or a button is pressed, the message is sent to dispatcherobject, which verifies whether the code is running in the current thread.

System. Windows. dependencyobject
When designing Silverlight, Microsoft considers a property-based architecture. In other words, the behavior of an object is mainly expressed by attributes, rather than methods, functions, and events. Now, we only need to remember its definition. In the subsequent sections, we will discuss this topic with special questions.
System. Windows. Media. Visual
Visual is a display support class used to abstract all the descriptions about drawing and display. It is an abstract class, and each framework element object must inherit this class. This class is mainly used to provide presentation support for Silverlight, including output display, transparency, coordinate conversion, and regional cut. In addition, the visual class is a bridge between the unmanaged milcore. dll and the managed Silverlight class. If a class is derived from visual, it can be displayed in the window. In this way, when you want to create your custom user interface, you can use visual objects.

System. Windows. uielement
The uielement class mainly deals with three aspects: layout, input, and event. This class inherits from the visual class, which defines many features related to input and focus, such as Keyboard Events, mouse and pen input. This class also includes APIs related to the Silverlight event model.

System. Windows. frameworkelement
Frameworkelement is derived from uielement. Based on uielement, it adds many other functions, such as horizontal alignment, vertical alignment, and margin, logical tree, object lifecycle events, support for data binding and dynamic resource reference, and support for style and animation.
System. Windows. shapes. Shape
This class can be used to create basic graphics, such as rectangles, polygon, elliptical, line, and path.

System. Windows. Controls. Control
This class provides some basic interface controls, such as text boxes. Button, list box, etc. In addition, it also adds some extended attributes, such as the font, foreground color, and background color.

System. Windows. Controls. contentcontrol
Contentcontrol is used to display multiple lines of text. Controls that contain a single item. Controls such as button, checkbox, and scrollviewer directly or indirectly inherit from this class.

System. Windows. Controls. itemscontrol
This is the base class of all controls that support display of multiple entries, such as the list box and Tree View. Generally, itemscontrol has two roles: it can be used to present a fixed item set or display the list obtained from Data Binding to an object. If you want to display data in the object source, you should specify itemssource as a reference to an object. For example, use ListBox to bind the data source to itemssource.

System. Windows. Controls. Panel
Panel can be used as all the layout containers. It can contain one or more child controls and arrange them according to the layout unit. These containers are the basis of the Silverlight Layout System, and the rational use of containers is the key to flexible layout of your interface content.

Address: http://blog.csdn.net/mr_raptor/article/details/7229618

The Silverlight control is divided by function, including:

  • User interaction control:

Button, checkbox, image, textblock, Textbox, etc.

  • Container Control:

Border, canvas, grid, stackpanel, viewbox, scrollviewer, etc.

Address: http://blog.csdn.net/mr_raptor/article/details/7229618

Container Control name

Function

Canvas

Defines an area. In this area, you can use coordinates relative to the area to explicitly locate the child element. A canvas can contain one or more uielement objects.

Grid

Defines a grid area consisting of columns and rows.

Stackpanel

Arrange child elements in a row (either horizontally or vertically ).

Border

Draw borders, backgrounds, or both around the other object.

Scrollviewer

Indicates a scrollable area that can contain other visible elements.

 

Address: http://blog.csdn.net/mr_raptor/article/details/7229618

User interaction control name

Main functions

Button

Provides a click event to respond to user input from the mouse, keyboard, pen, or other input devices.

Checkbox

Enables you to select (select) or clear (unselect) an option. The checkbox can have three states: select, cancel, and uncertain. Using checkbox can provide users with an option (such as "True/false" or "yes/no"), or allow users to select from the option list. Checkbox is a contentcontrol.

Hyperlinkbutton

A button control that displays hyperlinks. After you click hyperlinkbutton, you can navigate to an external webpage or content in the same Silverlight application.

Map

Indicates the default map class.

Image

Display images in PNG or JPEG format. The image control can display index images with one, four, or eight color depths, or real color images with 24 or 32 Color depths.

ListBox

Contains a set of items. You can bind the control to a data source or display unbound items to fill the control. A list box is an item control, which means you can fill it with items that contain text or other controls.

Mediaelement

Carries audio or video content. The mediaelement control provides a rectangular area for displaying a video (playing audio if no video exists) on its drawing.

Passwordbox

It is used to input sensitive or private information in the text area of a single line or a text area without line breaks. You cannot view the actual text, but can only view the characters that indicate the content.

Radiobutton

This allows you to select an option from a set of options. You can group radiobutton by placing the radiobutton control in the parent control or setting the groupname attribute of each radiobutton to a specific group. After grouping, each radiobutton control is mutually exclusive.

Scrollviewer

Encapsulate a piece of content and provide up to two scrollbar controls to scroll the content view area. The scrollviewer control allows you to set the size of the view area relative to the content and whether to display the horizontal and vertical scrollbar controls.

Slider

This allows you to move the thumb control along a track to select from a value range.

Textblock

Displays a small amount of text. You can use the text attribute to set the content of textblock. Alternatively, you can set the inlines attribute to an inline object set, such as a run or linebreak object.

Textbox

Used to obtain user input and display text. The text box control is usually used to edit text, but can also be set to read-only. Multiple rows can be displayed in the text box, and the lines can be automatically wrapped according to the control size.

Webbrowser

When the application is hosted outside the browser, a drawing is provided for displaying HTML content.

The controls shown in the preceding table are available controls in the toolbox in windowsphone. Obviously, these controls cannot fully meet developers' needs. Microsoft wants to reduce the size of WP7 applications by doing so, therefore, some very useful controls are not introduced. If you want to use a custom control or Silverlight control, you need to add Assembly reference in the project, and then introduce the namespace in The XAML root element to use the external control. For example, download and install the extended control of the Silverlight Toolkit:Http://silverlight.codeplex.com/

1. Add references to the project.

Address: http://blog.csdn.net/mr_raptor/article/details/7229618

 

2. Load the installed toolkit assembly to the project, path: C: \ Program Files \ microsoft sdks \ Windows Phone \ v7.1 \ toolkit \ oct11 \ bin

 

Address: http://blog.csdn.net/mr_raptor/article/details/7229618

3. Use external controls

Address: http://blog.csdn.net/mr_raptor/article/details/7229618

  • The solution browser shows that the Microsoft. Phone. Controls. Toolkit assembly has been added to the project (as shown in Figure 1 ).
  • Reference its namespace in the root element of XAML (as shown in 2 ).
  • Add the control element code (as shown in 3 ).
  • The corresponding control is displayed on the page.

In addition, there is a famous telerik design controls: http://www.telerik.com/products/windows-phone.aspx

++ ++

This article is original on this site. You are welcome to repost it! Reprinted please indicate the source:

Http://blog.csdn.net/mr_raptor/article/details/7229618

++ ++

 

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.