Hello,
we used to use a third-party docking control in our application which had some problems with the RadScheduler control.
Hence we've decided to exchange it with the RadDocking control, thus getting rid of any problems but the following.
We use a single-window application based on the MVVM pattern. Our window's ViewModel contains a collection of ViewModels and a "CurrentViewModel" property.
At this time we use the document host functionality only, resulting in the docking control displaying the "current" view via data templates.
Each ViewModel instance has its own view instance, which is required to be able to save the visual state of each view when switching from one view (model) to another. Views get created in a separate ViewCache class that returns either an already cached or a newly-created view.
I've provided a sample so you can easily reproduce the following steps (see attachment, needs to be renamed to *.zip):
1. Click button "Blue":
A blue ViewModel is created and added to the collection of ViewModels. The RadDocking control creates a new RadDocumentPane making use of a custom DockingPanesFactory.
The related view is created by the view cache via the above-mentioned data templates - getting the blue ViewModel and the blue view's type.
So far everything works fine.
2. Click button "Red":
A red ViewModel is created and added to the collection of ViewModels. Again, the RadDocking control creates a new RadDocumentPane.
But now something strange is happening: the view cache receives the red ViewModel and the blue view's type, which isn't supposed to happen because no such data template even exists (intermediate state?).
The view cache gets queried a second time immediately, this time with the correct parameters (red ViewModel and red view's type). As an aftereffect the blue view, which was provided in the step before, gets returned by the cache.
3. Click another color button:
Each time another color button is clicked, the same issue occurs.
So why does this "intermediate state" happen? Is this the intended behavior or just a bug?
Thanks in advance,
Jochen