Freigeben über


Introduction to the DeviceSpecific Control

For container controls, Visual Studio represents the <DeviceSpecific> markup language element as a special control. The designer's DeviceSpecific control provides you with a straightforward and intuitive method of targeting the appearance of Form and Panel controls to specific types of hardware devices.

Device Specific

Whenever you place a DeviceSpecific control within a Form or Panel control, the designer displays the control ID on the top line of the control. In addition, the DeviceSpecific control displays information about the current template device filter, which by default is not set to a value.

After you add a DeviceSpecific control to a container control, select Templating Options from the shortcut menu to define and apply device filters to the container. Like other types of controls, container controls use device filters to detect what type of hardware is displaying the current ASP.NET mobile Web Forms page. Applying device filters to a container enables developers to create templates for the container. It also provides the ability to set the container's property override values.

Choosing a device filter for the DeviceSpecific control results in the name of the current filter appearing in the Template Device Filter property in the designer's on-screen rendering of the control. The designer does not render the container by using the templates associated with the current filter. However, when the container is displayed on a mobile device or mobile device emulator that matches the property being evaluated by the device filter, ASP.NET renders the container according to the templates and property override values.

In Design view, you can edit only the templates and property override values of the current device filter. However, you can change the current filter at any time during your design work. To use a device filter different from the current filter, select Templating Options from the shortcut menu or use the TemplateDeviceFilter item in the Properties window.

Only one DeviceSpecific control can be applied to a Form or Panel control. It is possible to drag additional DeviceSpecific controls into a Form or Panel control. However, only the first DeviceSpecific control affects the container control. All additional DeviceSpecific controls display error messages indicating that they should be removed.

See Also

Tasks

How to: Add and Configure a DeviceSpecific Control

Concepts

<DeviceSpecific> Element

Introduction to the Form Control

Introduction to the Panel Control

Other Resources

Customizing ASP.NET Mobile Web Controls for Specific Devices