Skip to content

Syntax, nodes, and properties ​

Prolog and namespaces ​

Use PXML 1.0 strict mode for pages:

xml
<?pxml version="1.0" strict="true"?>
<Page xmlns="pcl://ui" xmlns:x="urn:pcl:pxml:x">
  <!-- page content -->
</Page>

The default namespace provides UI nodes; the x namespace provides compile-time directives. Component namespaces must resolve from registered build inputs, such as xmlns:local="urn:sample". PXML never downloads namespace contents over HTTP.

Four element categories ​

CategoryPurposeExamples
PrimitiveLowers directly to blueprint nodes/component dataText, Row, Column, Grid, Overlay, Scroll, VirtualList, NativeHost
ComponentCompile-time macro componentButton, VersionCard
DirectiveControls compilation or structurex:Const, x:IfBuild, x:If, x:For
TemplateStatic blueprint instantiated laterTemplate, x:Template

A component is not a runtime C# control. Its properties, slots, and nested components are expanded before Runtime sees the primitive data.

Literals ​

xml
<Node
  Visible="true"
  Opacity="0.8"
  ZIndex="100"
  Width="50%"
  MinWidth="120"
  Padding="16,12"
  Background="#FF2288" />
  • Lengths support fixed values, percentages, auto, and star weights (1*, 2*).
  • Thickness accepts one value for all sides, two for horizontal/vertical, or four for left/top/right/bottom.
  • Colors use #RRGGBB or #AARRGGBB.
  • Durations use ms or s.
  • Invalid or unsupported literals produce diagnostics; they never silently fall back.

Markup expressions ​

xml
<Text Text="{bind User.Name}" Foreground="{theme Text.Primary}" />
<Button Text="{loc Common.Continue}" Command="{cmd Navigation.Continue}" />
<Image Source="{res Images.Logo}" />

Common forms include bind, cmd, event, theme, res, loc, motion, feature, template, and ref. They lower to typed IDs or programs rather than reflection-based string lookup.

Identity and strict validation ​

Use x:Name only when a node is referenced and use stable Key/x:Key values for collections, templates, and structural reconciliation.

xml
<Button x:Name="MoreButton" Text="More" />
<Popup Anchor="{ref MoreButton}" />

Validate each increment with pxmlc check Page.pxml --strict. Strict mode rejects unknown properties, malformed literals, incompatible markup kinds, missing UI namespaces, invalid scopes, and unresolved components.

Next: Layout and sizing.