XAML preview tool window for WPF in Rider

A fresh new build of Rider 2018.1 EAP just landed with many new additions. There was already a WPF Application project template, and we have now added a XAML preview tool window for WPF (on Windows)! When working in a WPF window or control, we can preview the results of any change we make in XAML code directly in Rider. Let’s check it out!

WPF Application project template

When creating a new project in Rider, we can select the WPF Application project type to start from. Just like with any other project template, we can configure a number of things like the solution and project name, the target framework and whether we want to create a source control repository at once.

WPF Application project template in Rider

After creating a new WPF Application, we’re ready to look at another new addition to Rider: the XAML preview tool window!

XAML preview tool window

The latest Rider version comes with a built-in mechanism to preview the XAML we are working in. With any .xaml file open, we can use the View | Tool Windows | XAML Preview menu (or double-shift and type Xaml Preview) and immediately see what we are creating:

Preview XAML changes immediately using Rider WPF preview

When we have errors in our XAML markup, we will see Rider’s code analysis in action. In the preview window, the last successful preview is displayed, as well as an error message informing us that a preview is not available.

Errors in XAML markup are highlighted

It is important to note that the XAML preview window is non-interactive. This means you may have to e.g. set the active tab in a tab control to be able to see its contents, or move another control to the foreground to make it visible in the preview.

How does it work?

First things first: the XAML preview window currently only works on Windows. When working with XAML and opening the preview window, Rider launches a separate process that is used to render a preview of what our XAML would look like when executed as an application. The preview from that process is captured as a bitmap and then displayed in Rider.

From the settings (under Tools | XAML Preview), it is possible to set the quality of the rendered image, as well as configure transparency.

Set oversampling for XAML preview quality

Note this feature is still under active development and there are a number of things we’re still working on – if you encounter any issues while using the XAML preview in Rider, please open an issue in our tracker.

Give the latest Rider 2018.1 EAP build a try! We’d love to hear your feedback!

About Maarten Balliauw

Maarten Balliauw is a Developer Advocate at JetBrains, working on .NET tools. He focuses on .NET, Azure, web technologies and application performance. Maarten is a frequent speaker at various national and international events. In his free time, he brews his own beer. Follow him on Twitter or check his personal blog.
This entry was posted in How-To's and tagged , , , , , . Bookmark the permalink.

21 Responses to XAML preview tool window for WPF in Rider

  1. George cook says:

    And for xamarin forms too ppppllleeeeeaaaaassseeee

  2. Tom says:

    I take this is only available on windows (since neither mono nor .net core support wpf)?

  3. WPF is awesome.
    Good to have support for it in Rider!

  4. PassingBy says:

    Hopefully will be better than the original, I mean what is this:

    https://marketplace.visualstudio.com/items?itemName=Johan20D.KilltheWPFDesigner

    • Simon says:

      I’ve been testing Rider for the last 30 days and the xaml code editor works great:

      I haven’t experienced slowdowns or freezes which constantly happen with VS thanks to how they integrated xdesproc (enabling the compatibility assistant for the executable and setting it to windows 95 helps a bit because the process crashes immediately :P).

      As far as the preview is concerned, I haven’t gotten it to work just yet. We’re working with a huge code base (>350 projects), hundreds of custom styled xaml controls and rider’s preview failed on every of my last 5 tries.

  5. Carlos Mendoza says:

    hello I love jetbrains products, thanks for rider, how can I create a new xaml file for xamarin forms or add xaml file for wpf project?

  6. Hong says:

    because .net core has no supports for GUI

  7. Vincent Nagy says:

    Lovely addition to an awesome tool.

    Are you guys also planning to implement a full drag n drop designer one day? Or will we always be dependable on other tools for that?

    Thanks for the awesome addition!

  8. Michael says:

    If you add Xamarin Xaml Designer support i will buy in a heartbeat and i’m guessing a lot of other Xamarin developers too. :)

  9. Juan Pablo Vilchis Diaz S. says:

    Please make it available for Mac. There are some of us wanting to edit WPF on a Mac. Then we should build and test on a VM.

  10. Paulo Fernando Larini says:

    It’s not working in a x86 project in a windows 64 machine;

  11. Jason Liechty says:

    I don’t think the preview launches with the design mode property set as it is in Visual Studio. When using the Assisticant library, it uses that property to know if the data binding should be done with real vs seeded models. Is there a way to have the following resolve to true? “DesignerProperties.GetIsInDesignMode(new DependencyObject())”

Leave a Reply to PassingBy Cancel reply

Your email address will not be published. Required fields are marked *