WvdS VSCode UI Preview

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

Function and Purpose

The Preview extension provides:

  • Live Preview - Instant visualization of PXAML changes
  • Hot Reload - Automatic update on file save
  • Device Simulation - Preview on different screen sizes
  • Zoom Control - Zoom in and out of the preview

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:

  • Preview Area - Rendered UI
  • Toolbar - Zoom, device selection, refresh
  • Status - Last update time, errors

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:

  • Grid with star sizes (*)
  • MinWidth/MaxWidth constraints
  • ViewBox for scaling

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

  • Button Clicks - Visual feedback (no event handling)
  • Hover Effects - MouseOver styles are displayed
  • Focus - Focus frames are shown
  • Scroll - ScrollViewer works

Not Supported

  • Event handlers are not executed
  • Data binding shows only static data
  • Animations do not run
Full functionality is only available at runtime.

Error Display

On PXAML errors, the preview shows:

  • Error Message - Description of the problem
  • Position - Line and column in the code
  • Highlight - Erroneous location is highlighted

Example

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

Performance

Optimization

For faster preview:

  • Reduce complexity during development
  • Use design-time data instead of live data
  • Disable animations in design mode

Resource Usage

The preview runs in a WebView panel and uses:

  • Approx. 50-100 MB RAM
  • Minimal CPU when inactive
  • CPU spikes on updates

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

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