Developer

Responses to Context Update Events

The target tile can use the {$_context.<value>} syntax  to access passed values in its local context.

To update the UI whenever the context changes, hook in for the onContextChanged event and perform the uiRefresh action.

This example shows how to feed Tile3’s labels from the local context.
<Tile tileId="Tile3">
  <!--Refresh the UI when the context changes -->
  <Event eventId="onContextChanged">
    <Action actionId="uiRefresh" />
  </Event>
  <!--Stop further UI updates till the context updated event arrives -->
  <P pid="waitForContext" value="true" />
  <LinearContainer layout="vertical">
    <!-- Details skipped for brevity -->
    <UIElement type="label">
      <P pid="text" value="{$_context.platform}" />
    </UIElement>
    <UIElement type="label">
      <P pid="text" value="{$_context.type}" />
    </UIElement>
    <UIElement type="label">
      <P pid="text" value="{$_context.movieBO.Name}" />
    </UIElement>
  </LinearContainer>
</Tile>

In some cases, the tile cannot proceed until the context is updated by other tiles. This is especially true for iPad apps: while the master view is retrieving data, there is nothing to show in the detail view. Once the master tile has all the required data, it can update the detail tile’s context by firing an updateContext action. The detail tile, which has been on hold if waitForContext is enabled, can now resolve its bindings and refresh its UI.

This example demonstrates how the master tile updates the detail tile’s context, which is waiting for this to happen:
<Tile tileId="MasterTile">
  <P pid="width" value="300pt" />
  <P pid="height" value="910pt" />
  <BindingRef ref="Products" />
<ListContainer>
    <P pid="uiElementId" value="CategoriesList" />
    <P pid="width" value="300pt" />
    <P pid="height" value="910pt" />
    <ListSection>
      <ListItem>
        <P pid="actionIndicator" value="arrow" />
        <Event eventId="onClick">
          <!--Update the Detail tile when the user taps the cell-->
          <Action actionId="updateContext">
            <P pid="target" value="DetailTile" />
            <P pid="selectedCategory" value="Notebooks" />
          </Action>
        </Event>
      </ListItem>
    </ListSection>
    <!-- Further details skipped for brevity -->
  </ListContainer>
</Tile>

<Tile tileId="DetailTile">
  <!--Refresh the UI when the context changes -->
  <Event eventId="onContextChanged">
    <Action actionId="uiRefresh" />
  </Event>
  <!—Freeze the Tile till the context updated event arrives! -->
  <P pid="waitForContext" value="true" />

  <LinearContainer layout="vertical">
    <!-- Details skipped for brevity -->
    ...
  </LinearContainer>
</Tile>
For additional details about context-specific actions and parameters, see the extensibility configuration XSD file.