Contextual view switching
The contextual view switching functionality in DXA allows you to display your Views in a format proper for the device you are using.
The contextual view switching functionality is governed by the device-families.xml file, which contains a set of definitions for device families that DXA recognizes. These definitions allow DXA to distinguish between, for example, a mobile phone from a tablet. Each definition consists of context claims, which hold values that need to met by your device in order for DXA to display a View in a proper format.
<devicefamily name="smartphone">
<condition context-claim="device.mobile" value="true"/>
<condition context-claim="device.tablet" value="false" />
<condition context-claim="device.displayWidth" value=">319"/>
</devicefamily>Whenever a View is to be displayed, DXA scans the definitions in the device-families.xml file, and if all conditions set for a particular device family are met, a proper View is displayed.
The following naming convention applies to views: Viewname.<device_family_name>.cshtml|jsp
If the conditions for your device are not found in any of the device families definitions, DXA will use the default View.
- For .NET: \web\dist\bin\
- For Java: \web\sources\dxa-example-webapp\src\main\resources\