当前位置: 首页>>代码示例>>C#>>正文


C# Region.Remove方法代码示例

本文整理汇总了C#中Prism.Regions.Region.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# Region.Remove方法的具体用法?C# Region.Remove怎么用?C# Region.Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Prism.Regions.Region的用法示例。


在下文中一共展示了Region.Remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveInexistentViewThrows

        public void RemoveInexistentViewThrows()
        {
            IRegion region = new Region();
            object view = new object();

            region.Remove(view);

            Assert.AreEqual(0, region.Views.Cast<object>().Count());
        }
开发者ID:Citringo,项目名称:Prism,代码行数:9,代码来源:RegionFixture.cs

示例2: CanRemoveContentFromRegion

        public void CanRemoveContentFromRegion()
        {
            IRegion region = new Region();
            object view = new object();

            region.Add(view);
            region.Remove(view);

            Assert.AreEqual(0, region.Views.Cast<object>().Count());
        }
开发者ID:Citringo,项目名称:Prism,代码行数:10,代码来源:RegionFixture.cs

示例3: WhenViewHasBeenRemovedAndRegionManagerPropertyCleared_ThenItCanBeAddedAgainToARegion

        public void WhenViewHasBeenRemovedAndRegionManagerPropertyCleared_ThenItCanBeAddedAgainToARegion()
        {
            IRegion region = new Region { RegionManager = new MockRegionManager() };

            var view = new MockFrameworkElement();

            var scopedRegionManager = region.Add(view, null, true);

            Assert.AreEqual(view, region.Views.First());

            region.Remove(view);

            view.ClearValue(RegionManager.RegionManagerProperty);

            Assert.AreEqual(0, region.Views.Cast<object>().Count());

            var newScopedRegion = region.Add(view, null, true);

            Assert.AreEqual(view, region.Views.First());

            Assert.AreSame(newScopedRegion, view.GetValue(RegionManager.RegionManagerProperty));
        }
开发者ID:noufionline,项目名称:Prism,代码行数:22,代码来源:RegionFixture.cs

示例4: ViewRemovedEventPassesTheViewRemovedInTheEventArgs

        public void ViewRemovedEventPassesTheViewRemovedInTheEventArgs()
        {
            object removedView = null;

            IRegion region = new Region();
            region.Views.CollectionChanged += (sender, e) =>
                                                  {
                                                      if (e.Action == NotifyCollectionChangedAction.Remove)
                                                          removedView = e.OldItems[0];
                                                  };
            object model = new object();
            region.Add(model);
            Assert.IsNull(removedView);

            region.Remove(model);

            Assert.AreSame(model, removedView);
        }
开发者ID:noufionline,项目名称:Prism,代码行数:18,代码来源:RegionFixture.cs

示例5: RemovingViewAlsoRemovesItFromActiveViews

        public void RemovingViewAlsoRemovesItFromActiveViews()
        {
            IRegion region = new Region();
            object model = new object();
            region.Add(model);
            region.Activate(model);
            Assert.IsTrue(region.ActiveViews.Contains(model));

            region.Remove(model);

            Assert.IsFalse(region.ActiveViews.Contains(model));
        }
开发者ID:noufionline,项目名称:Prism,代码行数:12,代码来源:RegionFixture.cs

示例6: RemoveViewFiresViewRemovedEvent

        public void RemoveViewFiresViewRemovedEvent()
        {
            bool viewRemoved = false;

            IRegion region = new Region();
            object model = new object();
            region.Views.CollectionChanged += (sender, e) =>
                                                  {
                                                      if (e.Action == NotifyCollectionChangedAction.Remove)
                                                          viewRemoved = true;
                                                  };

            region.Add(model);
            Assert.IsFalse(viewRemoved);

            region.Remove(model);

            Assert.IsTrue(viewRemoved);
        }
开发者ID:noufionline,项目名称:Prism,代码行数:19,代码来源:RegionFixture.cs

示例7: GetViewReturnsNullAfterRemovingViewFromRegion

        public void GetViewReturnsNullAfterRemovingViewFromRegion()
        {
            IRegion region = new Region();
            object myView = new object();
            region.Add(myView, "MyView");
            region.Remove(myView);

            Assert.IsNull(region.GetView("MyView"));
        }
开发者ID:noufionline,项目名称:Prism,代码行数:9,代码来源:RegionFixture.cs


注:本文中的Prism.Regions.Region.Remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。