The UI Preview extension renders PXAML interfaces in real-time during development.
The Preview extension provides:
| Command | Description |
|---|---|
WVDS: Start Preview | Starts the live preview |
WVDS: Stop Preview | Stops the preview |
WVDS: Refresh Preview | Forces an update |
Method 1: Automatic
Method 2: Manual
Ctrl+Shift+P → WVDS: Start PreviewThe panel shows:
With Hot Reload enabled:
Ctrl+S)If automatic update does not work:
WVDS: Refresh PreviewThe 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 |
Use different devices to test responsive layouts:
*)| 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 |
The preview supports limited interaction:
On PXAML errors, the preview shows:
Error: Unknown element 'Buttn' at line 5, column 3 Did you mean 'Button'?
For faster preview:
The preview runs in a WebView panel and uses:
{
// Automatic refresh on save
"wvds.preview.autoRefresh": true,
// Delay before refresh (ms)
"wvds.preview.refreshDelay": 300,
// Default device
"wvds.preview.defaultDevice": "Desktop"
}
Cause: PXAML error or missing dependencies.
Solution:
Cause: Auto-refresh disabled or error.
Solution:
wvds.preview.autoRefreshCtrl+S)WVDS: Refresh PreviewCause: Design-time vs. runtime differences.
Solution:
d:DesignWidth, etc.)Cause: Complex UI or many updates.
Solution:
wvds.preview.refreshDelay| 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 |