开发者

Silverlight navigation between viewmodels

开发者 https://www.devze.com 2023-02-21 22:05 出处:网络
I\'m making a timeregistration project in Silverlight. I 开发者_如何学Gohave 2 kinds of rights, an admin and a user. I need to send the Logged in user object from one viewmodel to another.

I'm making a timeregistration project in Silverlight. I 开发者_如何学Gohave 2 kinds of rights, an admin and a user. I need to send the Logged in user object from one viewmodel to another.

Has anybody any idea how you can do this? Or if there is any alternative?

Help is really needed =)

Thx


You could create a Singleton class (or normal class registered as "singleton like" using your choosen DI container) and use that to store context.


You can use MVVM light messenger

In first view model:

Messenger.Default.Send<MessageWithUserObject>(new MessageWithUserObject(userObject));

In the second:

Messenger.Default.Register<MessageWithUserObject>(this, msg=>{//some action});
0

精彩评论

暂无评论...
验证码 换一张
取 消