问题
I have my own public property in App object. But it doesn't work while I trying to access it via App.Current.myProperty
. it work only via ((app)Application.Current).myProperty
.
I see a lot samples where people use App.Current
to access own properties. Did I missed something? Override Current
property?
回答1:
Yes, you should add your own Current
property into your App
class.
That's because it by default Application.Current
returns Application
class instance, not your derived class.
来源:https://stackoverflow.com/questions/20038421/app-current-myproperty-does-not-work-but-appapplication-current-myproper