开发者

How to remove view in wpf

开发者 https://www.devze.com 2023-03-04 05:10 出处:网络
How to remove view开发者_开发技巧 there is no error now, however the following code can not remove view, no change in display

How to remove view

开发者_开发技巧

there is no error now, however the following code can not remove view, no change in display

var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>()

foreach(var view in regionManager.Regions["Window1"].Views)
{
   if(regionManager.Regions["Window1"].Views.contains(this))
      regionManager.Regions["Window1"].Remove(this);
}


Don't remove it in a Foreach iterator. Use a for loop instead and loop through them backwards.

0

精彩评论

暂无评论...
验证码 换一张
取 消