Skip to content

Display HealthBridge data with UI Toolkit

The Health Data Review sample uses UIDocument, UXML, USS, and runtime VisualElement views. Keep HealthBridge operations in a controller or view model instead of individual visual elements.

Screen opens
↓
Show loading state
↓
Initialize or reuse HealthBridge
↓
Check capability and read data
↓
Map SDK records to display models
↓
Render content, empty, permission, unsupported, or error state

Pass only required presentation fields into a view:

  • Localized label.
  • Formatted date, duration, value, and unit.
  • Optional-metric visibility flags.
  • Non-sensitive category/icon information.
  • Route, retry, or delete availability.

Avoid giving every VisualElement record IDs, raw callbacks, or permission payloads.

An awaited operation can finish after a screen closes. Track whether the controller is still active before updating its UIDocument.

Subscribe to HealthBridgeEvents in OnEnable, unsubscribe in OnDisable, and stop monitoring when the feature closes. Do not start reads from a per-frame UI callback.

  • Loading
  • Content
  • Successful empty result
  • Permission guidance
  • Unsupported capability
  • Recoverable error

On iOS, an empty read must not claim that permission was granted or no records exist.

Populate an all-types picker from HealthBridgeService.GetDataTypeCapabilities() rather than a fixed set of chips. Group rows by row.Type.Category, show the registry display name, and retain the selected ID across filtering. Enable a row only when the active operation is allowed (CanRead for a read picker or CanWrite for a write picker). Disabled rows should show row.Reason.

Build write inputs from row.Type.GetFields(row.Platform). This keeps labels, units, legal category choices, and validation aligned with the SDK as supported types expand. Do not launch a native operation for a disabled row.

The Asset Store package includes Health Data Review under Assets/HealthBridge/Samples/. Study its UI Toolkit controller, workout cards, route preview, swipe-to-delete behavior, safe-area handling, and state panels. Create project-owned styles and view models rather than coupling production UI to sample internals.

Do not expose raw IDs, routes, or health payloads in screenshots, diagnostics, support UI, or shareable views.