This is a pretty simple bug. I can compile my app using .Net 4.7.2 and the ContainerFromItem returns the view model. When compiled with .Net 7, the function always returns null.
So really strange. Just after posting this, I re-compiled and then the function started to work.
[Modified 6 days ago]