當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。