If a conductor receives a new ActiveItem, and it's not active, it will deactivate that item

This is needed because the item being activated might actually be in the
closed state, and we'll need to bring it into the deactive state
This commit is contained in:
Antony Male 2015-01-15 09:33:09 +00:00
parent 20c708ddbe
commit c0562205de
2 changed files with 9 additions and 5 deletions

View File

@ -79,12 +79,12 @@ namespace Stylet
protected virtual void ActivateAndSetParent(IEnumerable items)
{
this.SetParent(items);
if (this.IsActive)
foreach (var item in items)
{
foreach (var item in items.OfType<IActivate>())
{
item.Activate();
}
if (this.IsActive)
ScreenExtensions.TryActivate(item);
else
ScreenExtensions.TryDeactivate(item);
}
}
@ -144,6 +144,8 @@ namespace Stylet
if (this.IsActive)
ScreenExtensions.TryActivate(item);
else
ScreenExtensions.TryDeactivate(item);
}
/// <summary>

View File

@ -46,6 +46,8 @@ namespace Stylet
if (this.IsActive)
ScreenExtensions.TryActivate(newItem);
else
ScreenExtensions.TryDeactivate(newItem);
}
this._activeItem = newItem;