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.

I have the same issue.

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.

However, as I understand PowerShell Tools automatically creates code behind file (default file name : WpfWindow1.xaml.ps1).

I followed steps from official PowerShell Tools User Guide (Building a GUI with WPF in Visual Studio 2022):

Q - does anyone know how to make Visual Studio find (or associate) wpf window with code-behind file ?
in order to use event handler

Its working fine on my VS Community 2022, How are you creating the Window? Are you right clicking the project → Add → New Item → (If on the compact view, then click Show all Templates) → PowerShell WPF Window → Add.