【发布时间】:2011-01-11 03:09:13
【问题描述】:
我有一个单例,一旦点击它就会加载用户配置文件信息,我想在我的 SL3 应用程序中使其成为应用程序级资源,以便整个应用程序的元素可以绑定到它。
我的实例化代码版本很简单
UserProfile x = UserProfile.GetInstance();
我希望能够在 app.xaml 文件中的 xaml 中执行此操作,而在 WPF 中我们有 ObjectDataProvider,因此我可以表达类似
的内容<ObjectDataProvider MethodName="GetInstance"
ObjectType="{x:Type local:UserProfile}" x:Key="CurrentUserProfile"/>
我正在努力在 SL3 中为此找到正确的实现。
【问题讨论】:
标签: c# silverlight data-binding xaml singleton