This is a migrated thread and some comments may be shown as answers.

Need an advice regarding BackStage and MVVM

2 Answers 88 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Eyal
Top achievements
Rank 1
Eyal asked on 12 Dec 2011, 03:27 PM
Hi,

I'm rather new to Telerik WPF controls (and WPF as a whole) and currently having a blast with them (awesome job guys).
While developing a WPF application for my company I encountered a small problem, not directly related to the controls themselves, but rather to the MVVM model and the way it works with the BackStage.

Basically, what I am building is an application that behaves similar to office tools, with BackStage that shows recent files created by the user. 
From the BackStage menu the user can open, edit etc these files. The files are opened on top of the main window, meaning that the main window always stays open (kinda like outlook and new mail items).

The application is using MvvmLight model/toolkit.

My problem is that, if the user creates a new file or edit a file, I have no way to reflect that in the "recent files" section of the BackStage - as the main window always stays in the background and the "recent files" section was bind to an object in the main window view model.

I guess that I can use some sort of a static collection, application scope, but it doesn't seem like a good practice.
What I was hoping is for some ideas on how to tackle that issue without breaking the MVVM model if possible.
Any idea would be greatly appreciated.

Cheers.

2 Answers, 1 is accepted

Sort by
0
Accepted
Miro Miroslavov
Telerik team
answered on 15 Dec 2011, 01:21 PM
Hi Eyal,

 You can use a feature of the MvvmLight called Messages. If your MainViewModel has a property RecentItems then you can listen for a message saying "Added to recent items" and respond to it with actually adding the item to the RecentItems collection. And also the message could be send by other ViewModel - for example DocuementViewModel.
You can my blog post about that, including an example project with messages.
Hope it helps.

Best wishes,
Miro Miroslavov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Eyal
Top achievements
Rank 1
answered on 15 Dec 2011, 09:27 PM
Thanks, that exactly what I needed
Tags
RibbonView and RibbonWindow
Asked by
Eyal
Top achievements
Rank 1
Answers by
Miro Miroslavov
Telerik team
Eyal
Top achievements
Rank 1
Share this question
or