The <DeviceSpecific> element provides a construct for specifying a choice between multiple content alternatives within template sets and within controls that require device-specific choices. Within a <DeviceSpecific> element, you typically specify one or more <Choice> elements, each containing attributes that specify how to evaluate the choice against target device capabilities. At run time, each choice is evaluated in order, and the first choice that is successfully evaluated is used. Each <Choice> element can contain the following:
A Filter property that specifies the name of the device filter to evaluate.
Additional properties that override properties of the parent control.
Template definitions for the control.
The choice element always evaluates to true if the Filter property is omitted. If no other choice is declared before it is picked, the default choice is picked.
Returns the collection of choices in a <DeviceSpecific> element.
Returns true if the currently selected choice of the <DeviceSpecific>/<Choice> construct has templates defined inside it.
Returns the mobile page containing this <DeviceSpecific> element.
Returns the owner of this <DeviceSpecific> element, either a control or a style.
Returns the currently selected choice, or null if none are applicable.
The following controls can contain a <DeviceSpecific> element.
A <DeviceSpecific> element can contain the following controls.
This example uses the PrefersGIF and PrefersWBMP device filters to choose among three image URLs based on device capabilities.
The specified device filters must be available in the Web.config file. For more information, see Mobile Device Capabilities.