WvdS VSCode UI Designer

The UI Designer enables visual PXAML development in VS Code - a WYSIWYG editor for Pascal-based user interfaces.

Function and Purpose

The Designer provides:

  • Visual Editor - Drag-and-drop UI design
  • PXAML Syntax - WPF/XAML-compatible markup for Pascal
  • Live Preview - Real-time preview during editing
  • Properties Panel - Visual property editing
  • Component Palette - Overview of available controls

What is PXAML?

PXAML (Pascal XAML) is an XML-based markup format for user interfaces, inspired by WPF/XAML.

Example

<Window Title="Hello PXAML" Width="400" Height="300">
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
 
    <Label Grid.Row="0" Content="Welcome!" FontSize="24"/>
 
    <StackPanel Grid.Row="1" Orientation="Vertical" Margin="10">
      <TextBox x:Name="txtInput" PlaceholderText="Enter name..."/>
      <Button Content="Greet" Click="OnGreetClick"/>
    </StackPanel>
  </Grid>
</Window>

PXAML vs. LFM

Aspect PXAML LFM (Lazarus)
Format XML Proprietary (Binary or Text)
Readability High Medium
Version Control Excellent (diff-friendly) Difficult
Designer WvdS Designer Lazarus IDE
Targets GUI, TUI, Web GUI only

Commands

Command Keyboard Shortcut Description
WVDS Designer: New PXAML File - Creates a new PXAML file
WVDS Designer: Toggle Designer Preview - Switches between code and design view
WVDS Designer: Show Properties Panel - Shows the properties panel

Working with the Designer

Creating a PXAML File

  1. Ctrl+Shift+PWVDS Designer: New PXAML File
  2. Enter a name
  3. The file is created with a base template

Opening Design View

When you open a .pxaml file, the designer is automatically activated.

The editor shows:

  • Design Area - Visual representation of the UI (left)
  • Properties Panel - Properties of the selected element (right)
  • Toolbox - Available controls (bottom left)

Code View

To edit the PXAML source code:

  1. Click „Source“ in the toolbar
  2. Or: Right-click → „View Source“

Adding Components

Via Drag & Drop:

  1. Drag a control from the Toolbox
  2. Drop it in the Design area
  3. Position it as desired

Via Code:

  1. Switch to Code view
  2. Add the element manually
  3. The preview updates automatically

Editing Properties

  1. Select an element in the Designer
  2. The Properties panel shows all available properties
  3. Change values directly in the panel
  4. Changes are immediately shown in the preview

PXAML Basics

Namespaces

<Window xmlns="http://schemas.wvds.de/pxaml/2024"
        xmlns:x="http://schemas.wvds.de/pxaml/x/2024"
        xmlns:local="clr-namespace:MyApp">
</Window>
Namespace Usage
Standard (no prefix) Base controls (Button, TextBox, Grid, …)
x: Markup extensions (x:Name, x:Key, …)
local: Custom types from the project

Layout Containers

Container Description
Grid Row and column layout
StackPanel Stacks elements horizontally or vertically
DockPanel Docks elements to edges
Canvas Absolute positioning
WrapPanel Wrapping arrangement

Common Controls

Control Description
Button Button with click event
TextBox Single-line text input
Label Text display
CheckBox On/off selection
ComboBox Dropdown selection
ListBox List selection
Image Image display
Border Border and background

Data Binding

<TextBox Text="{Binding Path=UserName, Mode=TwoWay}"/>
<Label Content="{Binding Path=WelcomeMessage}"/>

Event Handlers

<Button Content="Save" Click="OnSaveClick"/>

The handler is implemented in the code-behind unit:

procedure TMainWindow.OnSaveClick(Sender: TObject);
begin
  // Save logic
end;

Settings

The Designer uses the settings of the UI Meta extension for IntelliSense and component information.

Multi-Target Rendering

PXAML can be rendered for different targets:

Target Description Renderer
GUI Native desktop interface LCL-based
TUI Terminal interface Text-based
Web Browser interface HTML/CSS

The selection is made at build time, not in the Designer.

Troubleshooting

Designer Shows Empty Page

Cause: PXAML syntax error or missing components.

Solution:

  1. Switch to Code view
  2. Check the PXAML syntax (XML validation)
  3. Ensure all referenced components exist

Preview Does Not Update

Cause: Auto-refresh disabled or error.

Solution:

  1. Save the file (Ctrl+S)
  2. Run WVDS: Refresh Preview manually
  3. Check the Output Channel for errors

Drag & Drop Does Not Work

Cause: Wrong area or unsupported container.

Solution:

  1. Ensure you are dropping in the Design area
  2. Check if the target container allows children
  3. Some containers (e.g., Border) allow only one child

Technical Details

Property Value
Extension ID wvds.wvds-vscode-ui-designer
Activation onCustomEditor:wvds.ui.designer.pxaml
Dependencies wvds-vscode-core
Min. VS Code 1.85.0
File Format .pxaml

See Also

Zuletzt geändert: on 2026/01/29 at 10:26 PM