我在 app.xaml.cs 文件中创建了自己的自定义属性 我需要在我的一个 View 模型中访问此属性。 当我尝试通过应用程序对象访问时,它没有出现。 谁能帮我解决这个问题。
问候
最佳答案
使用 Application.Current
访问您创建的自定义属性。
var currentApp = Application.Current as App;
currentApp.YourPropertyName = "WhateverYouWant";
阅读此 article on MSDN举例说明如何操作。
关于c# - 如何访问在 Silverlight 4 的 App.xaml.cs 中创建的自定义属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8983546/