Compartir a través de


Device-Specific Composition

Although general composition is a useful feature, you can also compose the contents of a control differently based on the target device. Device-specific composition can enable some interesting scenarios. For example, you might want to compose an ImageMap control from an Image ASP.NET mobile control on one device and a set of Command mobile controls on another device.

Although you can insert device-specific code into the CreateChildControls method of a control, using such a technique is not recommended. Instead, create device-specific control adapters when attempting device-specific composition. You can create a new adapter class for each type of device, overriding the appropriate methods and adding controls to the control tree where appropriate. By creating new device adapters, you can easily change the control behavior for a new device with minimal changes to the control itself.

See Also

Other Resources

Adding New Device Adapters and Device Support

Creating Custom Mobile Controls