[Stick] WindowsPhone control details and reference external control Silverlight Toolkit

Source: Internet
Author: User
Tags map class
++ ++

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.