Dynamic Pages
APage can be created or replaced at runtime by a Function. This is useful for data-driven UI such as generated forms, detail views, or announcement bodies.
Declare a placeholder Page
Content must reference a declared Page during XML parsing, so declare an empty Page first:
Host.SetPage
Host.SetPage(name, xml):
name: the declared Page to override.xml: must use<Page>as its root.- Only visual nodes are allowed;
Data,Function,Trigger, andWidgetresources cannot be nested. - Each call reparses and replaces that Page.
- Page state is local to the current widget instance and resets when the XML reloads or the widget unmounts.
- Parse errors reject the call and can be caught by the Function.
Clear a Page
Relationship to static Pages
- Static Pages come from
Resource Type="Page"and provide the initial/editor-preview content. - A dynamic Page overrides the same-named static Page; without
SetPage, the static content is used. Content="{Result}"does not change syntax.
Limits
- Dynamic Pages cannot create new data sources, functions, or triggers.
- They reuse the current widget’s binding scope, converters, resources, and static Page references.
- Node count, depth, and XML size limits still apply.
Host.SetPageruns through the script sandbox; remote widget scripts still require executable-content confirmation.- Editor preview does not execute a real
Host.SetPage; verify dynamic content in the running widget.