在itemsControl Wpf中处理Usercontrol [英] Dispose Usercontrol in itemsControl Wpf

查看:71
本文介绍了在itemsControl Wpf中处理Usercontrol的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

推荐答案

根据您所展示的内容,很难提供帮助。

With what you have shown it really is difficult to help.

UserControl中可能存在导致其保持创建且未被销毁的内容。  

There could be something in the UserControl that is causing it to stay created and not get destroyed.  

此外,您的ItemsPane定义显示了不使用虚拟化的内容(一个网格)这样就可以创建新项目,而旧项目(见上文)可能不会被销毁。

Also your ItemsPane definition shows something that would not use virtualization (a Grid) so that new items will just get created and old ones (see above) may not be destroyed.

您也不会显示集合的定义。 如果它是ObservableCollection,那么它可能会更好。 设置新集合而不是从ObservableCollection中添加/删除项可能会导致问题。

You also don't show what the collection is defined as.  If it is an ObservableCollection then it might work better.  Setting a new collection rather than add/remove items from an ObservableCollection may cause problems.


这篇关于在itemsControl Wpf中处理Usercontrol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆