public void DeactivateThrows() { IRegion region = new AllActiveRegion(); var view = new object(); region.Add(view); region.Deactivate(view); }
public void AddingViewsToRegionMarksThemAsActive() { IRegion region = new AllActiveRegion(); var view = new object(); region.Add(view); Assert.IsTrue(region.ActiveViews.Contains(view)); }
public void DeactivateThrows() { var ex = Assert.Throws <InvalidOperationException>(() => { IRegion region = new AllActiveRegion(); var view = new object(); region.Add(view); region.Deactivate(view); }); }
/// <summary> /// Creates a new <see cref="IRegion"/> and registers it in the default <see cref="IRegionManager"/> /// attaching to it a <see cref="DialogActivationBehavior"/> behavior. /// </summary> /// <param name="owner">The owner of the Popup.</param> /// <param name="regionName">The name of the <see cref="IRegion"/>.</param> /// <remarks> /// This method would typically not be called directly, instead the behavior /// should be set through the Attached Property <see cref="CreateWindowRegionWithNameProperty"/>. /// </remarks> public static void RegisterNewWindowRegion(DependencyObject owner, string regionName) { // Creates a new region and registers it in the default region manager. // Another option if you need the complete infrastructure with the default region behaviors // is to extend DelayedRegionCreationBehavior overriding the CreateRegion method and create an // instance of it that will be in charge of registering the Region once a RegionManager is // set as an attached property in the Visual Tree. IRegionManager regionManager = ServiceLocator.Current.GetInstance <IRegionManager>(); if (regionManager != null) { IRegion region = new AllActiveRegion(); IHostAwareRegionBehavior behavior = ServiceLocator.Current.GetInstance <DialogActivationBehavior>(); behavior.HostControl = owner; region.Behaviors.Add(DialogActivationBehavior.BehaviorKey, behavior); regionManager.Regions.Add(regionName, region); } }
protected override IRegion CreateRegion() { IRegion region = new AllActiveRegion(); return(region); }