" App.Current.myProperty"不工作,但"((应用程序)Application.Current).myProperty"不

编程入门 行业动态 更新时间:2024-10-22 09:33:20
本文介绍了" App.Current.myProperty"不工作,但"((应用程序)Application.Current).myProperty"不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在App对象我自己的公共财产。不过,这并不在我尝试通过 App.Current.myProperty 来访问它的工作。它只能通过工作((APP)Application.Current).myProperty 。 我看到很多样,人们使用 App.Current 来访问自己的属性。难道我错过了什么?覆盖当前属性?

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?

推荐答案

是的,你应该添加自己的当前属性到应用类。

Yes, you should add your own Current property into your App class.

这是因为它在默认情况下 Application.Current 返回应用程序类的实例,而不是你的派生类。

That's because it by default Application.Current returns Application class instance, not your derived class.

更多推荐

" App.Current.myProperty"不工作,但"((应用程序)Application.Current).myProp

本文发布于:2023-10-18 13:03:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504305.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   工作   App   QUOT   Current

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!