开发者

Silverlight MVVM question

I'm working on a project and learning SL/MVVM as I go. I'm using MVVM light and feel as if I have a decent grasp of things. I understand binding controls to the VM and also sending events/commands to the VM.

A few questions I have:

In an MVVM application how is the Application object accessed from the VM, for calling Application.Install or checking install state? Or do you just stick it in the code behind of a view for that case? I suppose this could be done through MVVM me开发者_运维知识库ssaging but you'd still register a listener in the code behind.

I'm not sure if this can happen but how would one, from the VM, access a method from a View/Control(s) to do something that can't be accomplished through data binding or commanding/eventing? Is this where Dependency Object/Properties come into play?


The application should provide a service for obtaining the information relevant to the Application singleton; as with any data which could be used throughout the application; yours or the frameworks.

If you are ever needing to access a method on a UIElement/FrameworkElement/Control from the ViewModel that would be the point in looking into a custom Control or UserControl to provide the needed behavior. That is typically solved via Triggers and Behaviors.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜