LearnRevitAPI

Nov 6, 2024

Custom UI Forms for pyRevit

If you ever wanted to create a custom UI form for pyRevit tools, then you probably stumbled on WPF.

It's amazing skill to be able to create any form you need and provide much better user experience. However, as a beginner it can be really frustrating to get started with.

So I want to help you out.

What's WPF?

Firstly, let me address the elephant in the room for those who never heard of WPF before.

WPF is a modern .NET framework for creating 100% customizable UI forms. It comes with a collection of classes that you will need to learn to use.

It's very flexible and you can achieve any look or functionality you can imagine. But, it comes at the cost of learning curve.

💡WPF is also by far the most requested topic on my channel, and I can understand why. That's exactly why I'm so excited to publish tutorials on this topic.

My WPF Story

🪄 But first, let me share my story about learning WPF on my own.

Many years ago I wanted to create a custom UI for pyRevit. Like many of you, I discovered that I need to use WPF. And even though I knew nothing about it, I still decided to try.

There was almost no information on how to use it with IronPython, let alone pyRevit... So I had to figure it out on my own. But luckily, I'm a stubborn learner.

For some weird reason I was over ambitious. I wanted to create the coolest UI form that would do everything I wanted for printing PDFs from Revit. That was before ProSheets, so it's a major pain point for many.

I was so excited that I didn't even think about the back-end, and if I could even do that... I focused on front-end for days. And after days of struggling I got stuck and realized that I had absolute no idea what I was doing.

🔥My UI looked horrible and broken, so I deleted everything thinking it's not for me. I gave up on WPF that day...

Until later, I needed a custom UI again. But this time I decided to try a different approach.

I was more realistic and I started small with the simplest UI form in WPF you can imagine: TextBox + Button. It's can't get simpler.


I still struggled to understand WPF, but I made it work somehow. And then I focused on creating more simple UI forms, focusing on one new concept at the time. It was much easier to find solutions to smaller problems.

Slowly, I learnt more and more about WPF and my forms got much better. I learn about various controls, panels, styles, triggers, events and so on.

Eventually creating custom forms wasn't so much of an issue.


This time it was way more fun, because I didn't get stuck for days on the same problem. I was always learning something new one thing at the time. And it was much easier to find solutions to smaller problems.

🍵It's like this story about pottery class.
Students who did 30 pots in 30 days had way better results, than students who spent 30 days on a single perfect pot. Quantity is what leads to quality.

How would I learn from scratch?

But now looking back at the journey I can see how much easier it could have been if I had a few simple examples.

If only I had a few basic tutorials that could help me get started, I would save myself months of struggling with WPF.

Now I want to share a few things I've learn about WPF with other pyRevit Users.

But first, help me better understand your situation so I can provide better help.

What is your biggest challenge Learning WPF ?

Hit 'Reply' and share your challenges.

P.S.

The first module of my WPF Course for pyRevit Users will be posted on YouTube in the coming weeks to help you get started.

You will get:

Lesson 01 What is WPF and MVVM?
Lesson 02 Prepare WPF Dev Environment for pyRevit
Lesson 03 Beginner's Tour around Visual Studio
Lesson 04 Introduction to XAML (Create UI Form)
Lesson 05 XAML Debugging

Lesson 06 🎁Secret Lesson! (maybe even live)

👀 Stay tuned for more, and don't forget to share you biggest challenges with me!

Enjoyed Newsletter?

Leave a Testimonial Here.

⌨️ Happy Coding!
Erik Frits

Join Newsletter

📩 You will be added to Revit API Newsletter

Join Us!

which is already read by 7400+ people!