Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

Commented Issue: Wrong screen activation when tombstoning a panorama [293]

$
0
0
Hi,

Let be a MainViewModel which represents a panorama control with two different children types: ChildViewModel1 and ChildViewModel2. I've defined a MainStorageModel which persists the ActiveItemIndex so that I can restore the current viewmodel after tombstoning

```
this.ActiveItemIndex().InPhoneState().RestoreAfterViewLoad();
```

In the way back of tombstoning, the correct viewmodel is visualized, however the screen activation cycle is corrupted. That is, the ChildView2 is visualized while the log says that the screen ChildViewModel1 is activated, and the other way around when I move to ChildView1: the screen ChildViewModel2 is activated. Next tombstoning returns do not work anymore as the ActivatedItem is wrong.

I've tested the same with a Pivot control and everything is fine.

Any ideas what is going on?

Thank you very much in advance!

P.S.: Find below the convention I've used for the panorama:

```
ConventionManager.AddElementConvention<Panorama>(ItemsControl.ItemsSourceProperty, "SelectedItem", "SelectionChanged").ApplyBinding =
(viewModelType, path, property, element, convention) =>
{
if (ConventionManager
.GetElementConvention(typeof(ItemsControl))
.ApplyBinding(viewModelType, path, property, element, convention))
{
ConventionManager
.ConfigureSelectedItem(element, Panorama.SelectedItemProperty, viewModelType, path);
ConventionManager
.ApplyHeaderTemplate(element, Panorama.HeaderTemplateProperty, null, viewModelType);
return true;
}

return false;
};
```
Comments: And [Microsoft Connect Issue](https://connect.microsoft.com/VisualStudio/feedback/details/773758/silverlight-forum-wp8-panorama-using-itemssource-does-not-keep-track-of-selectedindex)

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>