WP8 - OnActivate event doesn't work in Screen

Topics: Actions & Coroutines
Mar 7, 2013 at 5:04 PM
Edited Mar 7, 2013 at 5:04 PM
I’m developing application for WP8 following this example:
http://www.matthidinger.com/archive/2011/10/16/RealWorldWPDev-Part-3-Caliburn-Micro-and-Application-Infrastructure.aspx
application works fine except OnActivate event – this event is not always fired in ViewModel, for 95% time when I’m moving between pages in panorama control this event is not fired but sometimes it fires but I don’t know why. My main view model implements Conductor<IScreen>.Collection.OneActive and have <controls:Panorama x:Name="Items"> in view. Every page is implemented as UserControl and corresponding ViewModel inherit from Screen (I have also tried Conductor<Screen>). Beside this I’m adding child views to items collection and they are visible after application run but events works like I have described above. Any ideas what is wrong here?
Mar 7, 2013 at 10:41 PM
how are populating and what are you populating?
Mar 7, 2013 at 11:17 PM
Edited Mar 7, 2013 at 11:18 PM
I'm not sure I'm understanding Your question but if You refer to populating Items I do it like in sample by Ioc in constructor of my conductor

public MainPageViewModel(INavigationService navigationService, HomeViewModel homeViewModel, LibraryViewModel libViewModel, StoreViewModel storeViewModel, SettingsViewModel settingsViewModel) 
        {
            this.navigationService = navigationService;

            this.Items.Add(homeViewModel);
            this.Items.Add(libViewModel);
            this.Items.Add(storeViewModel);
            this.Items.Add(settingsViewModel);
        }
Mar 8, 2013 at 6:03 AM
It seems that you have problem with Panorama control in WP8.
There is a severe bug in WP8 panorama control with databinding (see this issue).
Mar 8, 2013 at 7:25 AM
Edited Mar 8, 2013 at 7:26 AM
Tnx for link - i will look into this
Mar 12, 2013 at 10:11 AM
It look like I have to inherit from Conductor<object>.Collection.OneActive - it works for now. I hope this change don't give me another implications.