c# - Unobscured event gives NullReferenceException -
i trying add unobscured event root phoneapplicationframe this:
phoneapplicationframe rootframe = (phoneapplicationframe)app.current.rootvisual; rootframe.unobscured += new eventhandler((s, e) => { dosomething(); });
but when run windows phone 8 app gives me nullreferenceexception in second line of code sample. there other way this?
you need careful when access rootvisual
may still null. example, null in main page constructor. rootvisual
set in completeinitializephoneapplication
method in app.cs file.
Comments
Post a Comment