“App.Current.myProperty” does not work, but “((app)Application.Current).myProperty” does

流过昼夜 提交于 2020-01-04 06:05:54

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!