Inhaltsverzeichnis

WvdS VSCode UI Preview

The UI Preview extension renders PXAML interfaces in real-time during development.

Function and Purpose

The Preview extension provides:

Commands

Command Description
WVDS: Start Preview Starts the live preview
WVDS: Stop Preview Stops the preview
WVDS: Refresh Preview Forces an update

Working with the Preview

Starting the Preview

Method 1: Automatic

  1. Open a .pxaml file
  2. The Designer shows the preview automatically

Method 2: Manual

  1. Ctrl+Shift+PWVDS: Start Preview
  2. A new panel opens with the preview

Preview Panel

The panel shows:

Auto-Refresh

With Hot Reload enabled:

  1. Modify the PXAML file
  2. Save (Ctrl+S)
  3. The preview updates automatically

Manual Refresh

If automatic update does not work:

  1. Click the Refresh icon in the toolbar
  2. Or: WVDS: Refresh Preview

Device Simulation

The preview can simulate various devices:

Preset Width Height Use Case
Desktop 1920 1080 Standard desktop
Laptop 1366 768 Laptop screen
Tablet 1024 768 Tablet landscape
Tablet Portrait 768 1024 Tablet portrait
Mobile 375 667 Smartphone
Custom Variable Variable Custom size

Selecting a Device

  1. Click the Device icon in the toolbar
  2. Choose a preset
  3. Or: Enter custom dimensions

Responsive Testing

Use different devices to test responsive layouts:

Zoom Control

Action Keyboard Shortcut Description
Zoom In Ctrl+ Enlarges the preview
Zoom Out Ctrl- Reduces the preview
Fit Ctrl+0 Fits to available space
100% Ctrl+1 Original size

Interactivity

The preview supports limited interaction:

Supported Actions

Not Supported

Full functionality is only available at runtime.

Error Display

On PXAML errors, the preview shows:

Example

Error: Unknown element 'Buttn' at line 5, column 3
Did you mean 'Button'?

Performance

Optimization

For faster preview:

Resource Usage

The preview runs in a WebView panel and uses:

Settings

{
  // Automatic refresh on save
  "wvds.preview.autoRefresh": true,
 
  // Delay before refresh (ms)
  "wvds.preview.refreshDelay": 300,
 
  // Default device
  "wvds.preview.defaultDevice": "Desktop"
}

Troubleshooting

Preview Stays Empty

Cause: PXAML error or missing dependencies.

Solution:

  1. Check the PXAML syntax
  2. Check the Output Channel for errors
  3. Ensure all referenced resources exist

Preview Does Not Update

Cause: Auto-refresh disabled or error.

Solution:

  1. Check wvds.preview.autoRefresh
  2. Save the file explicitly (Ctrl+S)
  3. Run WVDS: Refresh Preview

Preview Shows Incorrect Display

Cause: Design-time vs. runtime differences.

Solution:

  1. Some features are only available at runtime
  2. Check design-time attributes (d:DesignWidth, etc.)
  3. Test with an actual build

High Resource Usage

Cause: Complex UI or many updates.

Solution:

  1. Increase wvds.preview.refreshDelay
  2. Reduce UI complexity
  3. Close unneeded preview panels

Technical Details

Property Value
Extension ID wvds.wvds-vscode-ui-preview
Activation onLanguage:pxaml
Dependencies wvds-vscode-core, wvds-vscode-ui-designer
Min. VS Code 1.85.0
Renderer WebView-based

See Also