0

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 !

4

1 に答える 1

1

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.

于 2012-12-21T06:45:22.510 に答える