Trying to Activate a View using Conductor<T>.Collection.OneActive

Topics: Bugs
Aug 18, 2011 at 8:46 PM

Howdy,

I'm not sure I've found a bug, but I'm having difficulties Deactivating my views.  I traced it all the way back to Conductor<T>.Collection.OneActive, because my views are never active.  They are visible, and quite interactable, but they are not active.

Could it be because of this code in Conductor<T>.Collection.OneActive?

                /// <summary>
                /// Activates the specified item.
                /// </summary>
                /// <param name="item">The item to activate.</param>
                public override void ActivateItem(T item) {
                    if(item != null && item.Equals(ActiveItem)) {
                        if (IsActive) {
                            ScreenExtensions.TryActivate(item);
                            OnActivationProcessed(item, true);
                        }
                        return;
                    }

                    ChangeActiveItem(item, false);
                }
It seems that the only way to activate a view using this conductor is to activate it manually, then call the Conductor's ActivateItem function.
What am I missing?
-Jeremiah
Coordinator
Aug 19, 2011 at 2:33 AM

You are correct. Screens/Conductors must be rooted in another Conductor in order to be activated (assuming that Conductor is activate) OR they must be shown by the WindowManager OR be the root ViewModel of the application. In those cases, the framework calls Activate. In other scenarios, it is difficult to know *when* or *if* activate should be called.