fbpx

Creating User Interfaces for Revit Add-ins: A Technical Comparison

Compare the different ways to do a UI in Revit

When developing add-ins for Revit, the user interface (UI) is a crucial component for providing a smooth and efficient interaction with the tool.

There are several options available for creating UIs for Revit add-ins, including:

  • WinForms
  • WPF
  • Web Embedded Views.

Each approach comes with its own set of advantages, disadvantages, and specific use cases. Below is a detailed comparison of these methods.

WinForms WPF and Web Embedded Views

1. WinForms (Windows Forms)

Overview

WinForms is a classic and straightforward method for creating UIs in Revit add-ins.

It uses the .NET Framework and provides a traditional approach to creating desktop applications with graphical user interfaces.

WinForms builds the UI using forms (windows) and controls like buttons, text boxes, etc.

Typically, it looks something like this:

WinForms example

Advantages

  • Simplicity: WinForms is simple and easy to implement, especially for developers with prior experience in traditional desktop applications.
  • Mature and well-supported: It has been around for a long time, so there is a wealth of resources, documentation, and community support available.
  • Integration with Revit: It seamlessly integrates with Revit, leveraging the Windows API to create native forms.

Disadvantages

  • Limited modern UI design: WinForms looks outdated compared to newer technologies like WPF. The UI elements can feel basic and unrefined, and it lacks built-in support for advanced styling or animations. So, it will take a lot of work to give style to something as simple as rounding corners to elements.
  • Less flexibility: Compared to more modern frameworks, WinForms offers limited control over layouts, theming, and scaling.

Use Cases of WinForms

  • Suitable for simple, legacy, or internal tools that do not require cutting-edge UI design or high customization.
  • Ideal for developers who need a quick and straightforward UI for small tools or utilities within Revit.
  • For quick development, if you are working on R&D or some POC.

2. WPF (Windows Presentation Foundation)

Overview

WPF is a more advanced UI framework within the .NET ecosystem, designed for creating modern and rich desktop applications.

WPF uses a declarative language called XAML (Extensible Application Markup Language) to define UI elements and their layout.

Here you can see an example of our Revit glTF exporter that allowed us to create a friendly UX/UI even compared to the Revit Interface:

Advantages

  • Advanced UI capabilities: WPF supports advanced features such as data binding, templates, and custom controls. This allows for the creation of sophisticated UIs with smooth animations, modern visuals, and high customization.
  • Separation of concerns: WPF encourages the separation of logic (code behind) and presentation (XAML), making the UI code more maintainable.
  • Scalability and theming: WPF supports vector graphics and automatic scaling, which makes it great for high-DPI displays and modern UI themes.

Disadvantages

  • Complexity: WPF is more complex than WinForms, requiring a steeper learning curve. It is harder to grasp, especially for developers unfamiliar with the MVVM (Model-View-ViewModel) design pattern.
  • Performance: Although WPF is highly powerful, it can sometimes be slower than more straightforward UI frameworks, especially when dealing with complex UIs.

Use Cases of WPF

  • Ideal for complex add-ins that require a polished, professional, and modern UI.
  • Suitable for applications that need advanced features such as custom controls, dynamic data binding, and high interactivity.
  • We suggest using WPF in all cases, except for apps that need a complex UI or that need deep integration with a cloud platform.

3. Web Embedded Views (HTML/JavaScript)

Overview

Web-based UIs can also be embedded in Revit using a WebView or Dockable Pane.

This allows you to create UIs with standard HTML, CSS, and JavaScript and then integrate them into the Revit environment as embedded views.

This is an example of how our website looks on an embedded Web View in Revit:

Embedded Web View in Revit Example

Advantages

  • Cross-platform: Since web UIs are built with standard web technologies (HTML, CSS, JavaScript), they can work across different platforms and environments, including future versions of Revit or other Autodesk tools.
  • Familiarity: Developers familiar with web development will feel at home with HTML and JavaScript, which allows for faster prototyping and development. Also, even if you are not familiar with a Front-End Framework, you could always use Blazor and stay using the technology that you are familiar with.
  • Rich interactivity: Web UIs can use JavaScript frameworks like React, Vue.js, or Angular to create highly interactive UIs with advanced state management and routing.

Disadvantages

  • Integration complexity: Revit doesn’t natively support web technologies. Therefore, you need to use a WebView or an embedded browser, which introduces additional complexity in communication between the web UI and the Revit API. We recommend using WebView2, but other alternatives like DotNetBrowser, CefSharp, or EO exist.WebBrowser
  • Performance: Depending on the complexity of the UI, web-based UIs can suffer from performance issues, especially with large datasets or complex interactions.
  • Limited native look-and-feel: Web UIs can sometimes feel disconnected from the native Revit environment, making integrating seamlessly into Revit’s UI style harder.

Use Cases of Web Embedded Views

  • Perfect for developers looking to create a modern, cross-platform web UI.
  • This is useful for scenarios where the add-in needs to pull data from a web service or when developing web-based tools that need to be integrated into the Revit environment.
  • Scenarios where you need to update the UI often.

WinForms, WPF and Web Embedded Views: Comparison Table

Below, you can find a quick comparison of the three options that you have:

Feature/FrameworkWinFormsWPFWeb Embedded Views
Ease of UseEasy to useSteeper learning curveRequires knowledge of web dev
CustomizationLimitedHigh (styling, data binding)High (JavaScript, HTML)
PerformanceFastModerate to HighVaries (depends on complexity)
Native Look and FeelGoodExcellentFair
Revit IntegrationSeamlessSeamlessModerate (requires WebView)
Cross-platformNoNoYes

If you want to see the three different options in action, you can check a Revit UI Showdown repo that we have put together Here

Deciding Between WinForms, WPF and Web for Revit Add-Ins

The best UI framework for your Revit add-in depends on the complexity of the UI, the developer’s expertise, and the project’s specific needs.

  • WinForms is ideal for quick, simple tools with limited design complexity.
  • WPF shines when creating sophisticated, modern UIs with advanced features.
  • Web Embedded Views are perfect for really complex UIs, projects that require deep integration with a cloud platform, or situations where the UI needs to be updated frequently.

Each option can be powerful when used in the proper context, so it’s essential to evaluate your project’s requirements before making a decision.

2698 Views

I'm a versatile leader with broad exposure to projects and procedures and an in-depth understanding of technology services/product development. I have a tremendous passion for working in teams driven to provide remarkable software development services that disrupt the status quo. I am a creative problem solver who is equally comfortable rolling up my sleeves or leading teams with a make-it-happen attitude.