Adding a wpf event handler doesn't work with PowerShell Tools for Visual Studio 2022

Today I installed the Windows 11 dev environment, which is a VM one can get from Download a Windows virtual machine - Windows app development | Microsoft Developer or directly from the Hyper-V Manager (Actions → Quick Create).

On this VM I started VStudio, installed PowerShell Tools from the marketplace and tried the WPF example as it is shown on YouTube Building a WPF Form with PowerShell in Visual Studio 2019 - YouTube

Everything was fine until the event handler was added. When I select the (named) control and click the lightning button on the property window following message appears
"The document item has no code-behind file. Add a code-behind file and a class definition before adding event handlers.

To reproduce that behaviour you just need to run that VM without any changes to the VS 2022 installation.