# Tutorial: Handling UI navigation with MVVM and Common Activatable Widgets

**URL:** <https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457>\
**Category:** Tutorial & Course Discussions\
**Tags:** unreal-engine\
**Created:** [June 29, 2025, 6:37pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457 "2025-06-29T18:37:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![IreneZanon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irenezanon/32/618468_2.png) [@IreneZanon](https://forums.unrealengine.com/u/IreneZanon)\
**Post date:** [June 29, 2025, 6:37pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/1 "2025-06-29T18:37:36Z")

</div>

This tutorial shows how to handle UI navigation on a screen in a simple and flexible way, using MVVM (the Model View ViewModel pattern) to create a Selection View Model and Common Activatable Widgets to manage focus. The process requires zero coding, and will be focused on UMG and blueprint-based MVVM.

We will implement a focus-based navigation in a simple screen where elements like lists, tiles and buttons communicate with each other using the Selection View Model and with the help of Common Activatable Widgets.  
  
[https://dev.epicgames.com/community/learning/tutorials/ep4k/unreal-engine-handling-ui-navigation-with-mvvm-and-common-activatable-widgets](https://dev.epicgames.com/community/learning/tutorials/ep4k/unreal-engine-handling-ui-navigation-with-mvvm-and-common-activatable-widgets)

---

<div class="post-metadata">

**Author:** ![origin](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/origin/32/882196_2.png) [@origin](https://forums.unrealengine.com/u/origin)\
**Post date:** [July 2, 2025, 8:50am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/2 "2025-07-02T08:50:02Z")

</div>

Excellent tutorial, thank you. wish for more cause the 2023 talk is hard to follow for newcomers.

---

<div class="post-metadata">

**Author:** ![Tempelking](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tempelking](https://forums.unrealengine.com/u/Tempelking)\
**Post date:** [July 13, 2025, 8:07pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/3 "2025-07-13T20:07:39Z")

</div>

Hi,  
I finished the tutorial and when I press the button “Equip” or “Mark as Junk” without triggering the modal, the selected Item loses focus. Or when I click somewhere on the screen the item loses focus too. Is there a way to keep the focus on the item after pressing on the screen/button?

---

<div class="post-metadata">

**Author:** ![IreneZanon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irenezanon/32/618468_2.png) [@IreneZanon](https://forums.unrealengine.com/u/IreneZanon)\
**Post date:** [July 14, 2025, 10:54am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/4 "2025-07-14T10:54:56Z")

</div>

Hello! Great catch.  
The whole keyboard-mouse input management in UE isn’t handled the same way it’s handled with gamepad unfortunately, which means:

- When you switch between mouse and gamepad, `GetDesiredFocusTarget()` is called and focus is re-evaluated. This doesn’t happen when you switch between mouse and keyboard. That’s because UE assumes you might still be using mouse-based navigation alongside keyboard shortcuts.
- This is annoying when we want to implement a focus-based navigation, because we have no way of automatically refreshing the focus when switching from mouse to keyboard.

The other annoying thing is that when you click on a non-focusable widget (like a background image or border, or even a button that is hit-testable but not focusable, like our Equip and Junk buttons), Unreal sets focus to the viewport instead of maintaining focus within the UI.  
Then, when you switch to keyboard, no widget is focused, so navigation doesn’t work, but if you switch to gamepad, Unreal detects an input method change, so it will trigger a focus re-evaluation calling the various `GetDesiredFocusTarget()` functions.

I can tell you in advance that there is no elegant way of solving this that I know of (and I suppose it’s not a surprise that in many games keyboard navigation is poorly supported), but there are still a couple of workarounds we can implement that use our _SelectionVM_ and `GetDesiredFocusTarget()`.

So there are 2 issues we need to fix:

1. not lose focus when clicking on a background element, like a background image or the text in the item details panel
2. not lose focus when clicking on a non-focusable button (the Equip and Junk buttons)

keeping in mind that:

1. we want to avoid using events and delegates, keeping loose dependencies
2. we want to avoid calling `SetFocus()` and instead prefer `RequestRefreshFocus()` and `GetDesiredFocusTarget()`

So here’s what we’re going to do:

1. Add a utility function in the SelectionVM to request a focus refresh (this is so that any widget might request a focus refresh, and not only Common Activatable Widgets)
2. Add a new FieldNotify property in the SelectionVM so that the widgets that can handle focus can also listen to external refresh focus requests from other widgets
3. Introduce a FocusCatcher button to catch click events to the inventory background. This way we can catch the focus and redirect it before losing it
4. Have our non-focusable buttons use the new utility function in the SelectionVM to re-evaluate the focus when they’re clicked, instead of just allowing Slate to panic

So let’s go:

1. In the _SelectionVM_ view model class, add the new function `RequestRefreshFocus()` and a new property bool `FocusRefreshRequested`  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/9/a/b9a5e8b7239c2de5a6a33c79728b0a76f3fe68f8.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/1/d/01db92e7a0987bfcdc1554f29431b7c9826ed906.png)
2. In _WBP\_Inventory_ add a new button to the hierarchy (_Button\_FocusCatcher_) that spans the whole viewport, set it as _Focusable_ and _Visible_  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/d/b/3dbdf1a0adc869fce7ca289df70daa2708b8ab53.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/9/c996565364c8d4d6f42ce5bdbc3a6d554cdb0580.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/a/2/ba265729dcff4570302e070cbd87296f5077c10e.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/b/dbb09c5cba6777b3f24a107e77323b39a480de5f.png)
3. When the new button is clicked (= when we click somewhere on the screen), we now call the `RequestRefreshFocus()` function of the _SelectionVM_  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/a/e/3aeec1450a15c66a3b2229aa1adaa9754365177f.png)
4. We now create a new function in _WBP\_Inventory_ to listen to the View Binding of our new property. We call this `ForceFocusEvaluation()` and it will take the new property as input. If the bool is true, means we have a focus refresh request, so we can now use a widget that is Common Activatable Widget to actually call the proper `RequestRefreshFocus()` function of activatable widgets.  
But there’s a catch! One thing I haven’t mentioned in the tutorial (didn’t want to overload with information) is that `RequestRefreshFocus()` will trigger a focus re-evaluation ONLY if requested by the _ **leaf-most** _ _ **active** _ activatable widget. What does this mean? It means that in our case our activatable widgets are _WBP\_Inventory_ and _WBP\_Category_, and the leaf-most active is _WBP\_Category_ (because it’s deeper in the hierarchy). So if we call `RequestRefreshFocus()` from _WBP\_Inventory_, nothing will happen, because _WBP\_Inventory_ isn’t our leaf-most active widget. So instead we need to call it from _WBP\_Category_.  
So we can either add our `ForceFocusEvaluation()` function to _WBP\_Category_, or we can just implement the function in a way that it will call `RequestRefreshFocus()` on _WBP\_Category_ instead of _self_ - which is what I chose for the screenshot.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/3/2/63212b22c934bbbc87ec80d693627583a850629a.png)
5. We can now create the view binding that binds the _SelectionVM_ property to the `ForceFocusEvaluation()` function  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/1/4/d142f9ae4b23934b5727f540affb8e9acaa0f619.png)

So this part takes case of the case when you click somewhere on a screen. You’ll now see that when you click around instead of losing focus, the focus will be refresh to the currently selected item tile.

Next is solving the bug when clicking on the Equip and Junk buttons.

1. We open _WBP\_ItemDetails_ and simply call `RequestRefreshFocus()` of the _SelectionVM_ on the `OnCliked` events of both buttons.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/2/8228fcc2fc1f6ca0913205ed9be33a71fbee6413.png)

And this should fix those issues! As I said, not the most elegant solution, but should do the trick for the moment. At Epic we’re discussing focus issues and how to improve this on a regular basis, so I hope we’ll get to better keyboard support as soon as possible.  
Let me know how this goes - I might add this as an appendix to the tutorial.

---

<div class="post-metadata">

**Author:** ![IreneZanon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irenezanon/32/618468_2.png) [@IreneZanon](https://forums.unrealengine.com/u/IreneZanon)\
**Post date:** [July 14, 2025, 10:56am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/5 "2025-07-14T10:56:31Z")

</div>

Hello! I’m glad this was helpful.  
I’m considering making a new tutorial using the same project, but instead of showing how to use MVVM to handle navigation, I would show how to use MVVM to populate our widgets. So it would basically be creating view bindings, functions, conversion functions and so on.  
Would that be helpful?

---

<div class="post-metadata">

**Author:** ![Tempelking](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tempelking](https://forums.unrealengine.com/u/Tempelking)\
**Post date:** [July 14, 2025, 7:42pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/7 "2025-07-14T19:42:57Z")

</div>

Thanks for the detailed response. It works like charm.

---

<div class="post-metadata">

**Author:** ![SoulDende11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SoulDende11](https://forums.unrealengine.com/u/SoulDende11)\
**Post date:** [July 16, 2025, 8:50am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/8 "2025-07-16T08:50:20Z")

</div>

Thank you very much for this tutorial! It’s a very good resource! 😃

It would be nice to delve deeper into the topic of resolvers. Specifically, how to use them to retrieve viewmodels in a multiplayer context where I need to display information about other players.

---

<div class="post-metadata">

**Author:** ![IreneZanon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irenezanon/32/618468_2.png) [@IreneZanon](https://forums.unrealengine.com/u/IreneZanon)\
**Post date:** [July 16, 2025, 1:26pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/9 "2025-07-16T13:26:44Z")

</div>

Hello! Thanks for the feedback, I noted it down as a follow-up topic!

---

<div class="post-metadata">

**Author:** ![simmosimosa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@simmosimosa](https://forums.unrealengine.com/u/simmosimosa)\
**Post date:** [July 18, 2025, 12:45pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/10 "2025-07-18T12:45:59Z")

</div>

yes! that would be very helpful Irene!

---

<div class="post-metadata">

**Author:** ![StefanTwigt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@StefanTwigt](https://forums.unrealengine.com/u/StefanTwigt)\
**Post date:** [July 22, 2025, 12:05pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/11 "2025-07-22T12:05:02Z")

</div>

+1 on extra tutorial about how to fill the views with the data. (or how to set this up…I am checking the files with your tutorial, and have the feeling there is still quite some BP graphs to get everything working)

---

<div class="post-metadata">

**Author:** ![simmosimosa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@simmosimosa](https://forums.unrealengine.com/u/simmosimosa)\
**Post date:** [August 1, 2025, 2:04am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/12 "2025-08-01T02:04:35Z")

</div>

Hi Irene,

I have a question regarding how unral handles unused ViewModels. For example: When initializing them on a Widget creation each time it loads an inventory UI, The best way i have found so far is to create a viewmodel for ac item when activating the widget. Problem is creating a new viewmodel for each item everytime that ui is activated. I dont see any options to "destroy the viewmodel when you deactivate the widget, so in theory each viewmodel is still somewhere in memory. COuld you elaborate a bit more on how to reference a large amount of viewmodels instead of having to recreate them every time? Or does unreal garbage collect somewhere behind the scenes.

Thanks!

Simon

---

<div class="post-metadata">

**Author:** ![siqso\_99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@siqso\_99](https://forums.unrealengine.com/u/siqso_99)\
**Post date:** [August 7, 2025, 1:12pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/13 "2025-08-07T13:12:09Z")

</div>

Am the the only one confused by this tutorial? Would have wanted to see how MVVM works in a simple practical example instead of hearing basic explanations of icons you see on the screen?

Personally could not find out what MVVM is used for after watching 3 videos. “We see an rpg fantasy inventory screen” yeah we see, please move on and show how to use MVVM.

---

<div class="post-metadata">

**Author:** ![homsar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@homsar](https://forums.unrealengine.com/u/homsar)\
**Post date:** [August 8, 2025, 3:38pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/14 "2025-08-08T15:38:12Z")

</div>

Hello, excellent tutorial, this was very helpful for seeing a more practical usecase for setting up and sharing data with viewmodels.

I was wondering, what methods do y’all use for resolving VM methods? You mention an alternative to using global viewmodels (something about a technique someone figured out in Orlando?), but also that on the Fortnite UI team, resolvers are the primary method of setting up and accessing VMs.

I often seem to be getting errors or VMs in a bad state when relying on a global viewmodel collection, and would love to know more about alternatives or intended ways to handle this.

Thanks again, it’s really helpful to have more examples showing how powerful MVVM can be.

---

<div class="post-metadata">

**Author:** ![Cody325M](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cody325m/32/911474_2.png) [@Cody325M](https://forums.unrealengine.com/u/Cody325M)\
**Post date:** [August 12, 2025, 6:25am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/15 "2025-08-12T06:25:40Z")

</div>

This is awesome! I especially loved that you talked about you thought process. “What’s the data that we need to track?” “Who needs to know about the selected category being updated?”

I’m working on an RTS and I’m stumbling over getting the correct set of widgets to display. I think what you did here is a much better solution than what I was doing. I tried repurposing a command pattern I set up for units, and then I had an interface with a function that had a struct as a param, and the struct keeps getting random things added to it as I need them. This looks more promising.

Side note. I had no idea that you could bind a widget’s function to a VM’s array. Blew my mind. I’ve been binding to a delegate, the old school way.

In general thanks! Your other content is great. I use grid box and wrap box and cool things with the common visual attachment when I want to avoid taking up layout space. Never would’ve known about them had you not told me.

* * *

“But I’m also considering creating an additional tutorial showing the standard usage of MVVM to represent data and populate our widgets: a deep dive into view bindings, conversion functions and more!”

There’s a few ways to organize, maintain, and deliver learning content. I have a suggestion. There’s a few “Your first 60 minutes with \_\_”. The “Your first 60 minutes with GAS” is a good example. Additionally, the same guy wrote a few following on guides, because you can’t cover everything in 60 minutes. There’s a best practices that covers some edge cases & decisions and a guide on advanced debugging.  
What I’m suggesting is a First 60 min with MVVM and CommonUI. With some follow on guides like slate debugging, umg performance profiling, deep dive into whatever floats your boat.

Alternatively, there are no sample projects using MVVM. Cropout, Lyra, ParrotGame, StackOBot, the new templates are not using it. A sample project would be epic. Arran Langmead, Sam, and Sebastian, work for Epic and are always goofing around, and could make a project. A RTS / RPG hybrid project would have a lot of UI things among other stuff.

---

<div class="post-metadata">

**Author:** ![IreneZanon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irenezanon/32/618468_2.png) [@IreneZanon](https://forums.unrealengine.com/u/IreneZanon)\
**Post date:** [August 15, 2025, 10:24am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/16 "2025-08-15T10:24:56Z")

</div>

Hi and thanks for your feedback! Would you mind giving me some details on how it didn’t match the expectations? Was the goal of the tutorial unclear or did you not find the information you were looking for (or both? XD) ?  
I’m suspecting you might have been looking for a basic tutorial on how to use MVVM to populate a screen, whereas this is a tutorial on how to use MVVM to handle navigation on a screen, where the data has already been populated.

---

<div class="post-metadata">

**Author:** ![IreneZanon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irenezanon/32/618468_2.png) [@IreneZanon](https://forums.unrealengine.com/u/IreneZanon)\
**Post date:** [August 15, 2025, 10:26am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/17 "2025-08-15T10:26:17Z")

</div>

Thank you Cody! I’m glad this was helpful!  
And thank you for the suggestions on the educational content, that’s great advice and I think a “your first 60 minutes with MVVM” would be a great starter topic.  
Thanks again!

---

<div class="post-metadata">

**Author:** ![IreneZanon](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irenezanon/32/618468_2.png) [@IreneZanon](https://forums.unrealengine.com/u/IreneZanon)\
**Post date:** [August 15, 2025, 10:35am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/18 "2025-08-15T10:35:11Z")

</div>

Hello! Thanks for your comment!  
I’m going to organize some brief content about resolvers, so that I can answer all the questions I received about them.  
During the Unreal Fest in Orlando, one of the attendees was able to create a resolver using the resolver asset completely in blueprint. I wouldn’t necessarily suggest that for a full project and instead I’d go the C++ route, creating a Global VM Resolver (UMVVMViewModelContextResolver).  
I want to sync up with our UI engineers on Fortnite so that I can get accurate information. 🙂

---

<div class="post-metadata">

**Author:** ![notrealvitor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/notrealvitor/32/731461_2.png) [@notrealvitor](https://forums.unrealengine.com/u/notrealvitor)\
**Post date:** [August 15, 2025, 7:49pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/19 "2025-08-15T19:49:09Z")

</div>

Thanks for the great tutorial! It was very good to refresh what I knew about the MVVM and also learned some stuff. Missed more details about the conversion functions, as I recall it has to be a const and only one input of the same type? Sometimes I struggle a bit with it.  
I have a question… can I use the viewmodel to store and calculate gameplay status like health and mana in a PlayerController or it is something that should be strict to widgets?

---

<div class="post-metadata">

**Author:** ![notrealvitor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/notrealvitor/32/731461_2.png) [@notrealvitor](https://forums.unrealengine.com/u/notrealvitor)\
**Post date:** [August 21, 2025, 3:47pm UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/20 "2025-08-21T15:47:38Z")

</div>

To update, I thought it was better to add my PlayerStatusVM in a PlayerState, had to add it with C++ to be better accessed by the PlayerController, I think I will do the calculations there and update the VM when it is completed.  
A bit of experimenting with the conversion functions, it needs the input and output values to be of the same type and the function needs to be const and pure. I was able to make it work with two inputs, didn’t test further because thats what I need for now. 👌

---

<div class="post-metadata">

**Author:** ![Zwareee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zwareee](https://forums.unrealengine.com/u/Zwareee)\
**Post date:** [August 22, 2025, 4:01am UTC](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457/21 "2025-08-22T04:01:42Z")

</div>

Thanks，great tutorial

[Next page](https://forums.unrealengine.com/t/tutorial-handling-ui-navigation-with-mvvm-and-common-activatable-widgets/2584457.md?page=2)
