I have a Window Runtime Component that accesses the Window.Current object, to add an handler on the VisibilityChanged event.
If I run that code in a C# Windows Store App, it runs perfectly (as soon as I do that in a method where the Window has been initialized).
Unfortunately, I am unable to do that in a WinJS app. It breaks when I launch the app.
Why ?
Thanks !
Window.Current is a XAML concept. It simply doesn’t exist in an HTML/JS app. You can’t host or use XAML objects in a WinJS app.
You need to attach to the corresponding browser events instead, in Javascript.