bug in singleactiveregion.cs?

Topics: Prism v4 - WPF 4
Nov 17, 2010 at 4:50 AM

    public class SingleActiveRegion : Region
    {
        /// <summary>
        /// Marks the specified view as active.
        /// </summary>
        /// <param name="view">The view to activate.</param>
        /// <remarks>If there is an active view before calling this method,
        /// that view will be deactivated automatically.</remarks>
        public override void Activate(object view)
        {
            object currentActiveView = ActiveViews.FirstOrDefault();

            if (currentActiveView != null && currentActiveView != view && this.Views.Contains(currentActiveView))
            {
                base.Deactivate(currentActiveView);
            }
            base.Activate(view);
        }
    }

 

should we check ---this.Views.Contains(view) ?  not currentActiveView?

Nov 17, 2010 at 6:59 PM

Hi,

There are no issues reported related to this so far. Please, take into account that this Region type allows a maximum of one active view at a time. It means that when you add a view to this region, the current one must be deactivated previously.

Have you experienced an issue with this?

Fernando Antivero
http://blogs.southworks.net/fantivero