在WPF中使用的虚拟包装面板没有太多选择。出于某种原因或另一种MS决定不将其发布到标准库中。
There are not very many options for a virtualizing wrap panel for use in WPF. For one reason or another MS decided to not ship one in the standard library.
如果有人敢于向公众提供答案(和解释),以下codeplex项目的第一个工作项目,我将不胜感激:
If anyone could be so bold as to provide a crowd source answer (and explaination) to the first work item on the following codeplex project, I would greatly appreciate it:
virtualwrappanel.codeplex/workitem/1
谢谢!
问题摘要:
我最近尝试使用此项目中的虚拟包装面板,并且遇到了错误。
I've recently tried using the virtualizing wrappanel from this project and have encountered a bug.
复制步骤:
Debug.Assert失败(Debug.Assert(child == _children [childIndex], MeasureOverride中的生成了错误的子级);),并且继续执行会导致Cleanup方法中出现空异常[请参见随附的屏幕截图]。
The Debug.Assert fails (Debug.Assert(child == _children[childIndex], "Wrong child was generated");) in MeasureOverride, and continued execution results in a null exception in the Cleanup method [see attached screenshot].
请让我知道您是否能够纠正此问题。
Please let me know if you are able to correct this.
谢谢,
AO
代码:
virtualwrappanel.codeplex/SourceControl/list/changesets#
替代文字virtualwrappanel.codeplex/Project/Download/AttachmentDownload.ashx?ProjectName=virtualwrappanel&WorkItemId=1&FileAttachmentId=138959
推荐答案OnItemsChanged方法需要正确处理args参数。有关更多信息,请参见此问题。复制该问题的代码,您需要像这样更新OnItemsChanged:
The OnItemsChanged method needs to properly handle the args parameters. Please see this question for more information. Copying the code from that question, you would need to update OnItemsChanged like so:
protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args) { base.OnItemsChanged(sender, args); _abstractPanel = null; ResetScrollInfo(); // ...ADD THIS... switch (args.Action) { case NotifyCollectionChangedAction.Remove: case NotifyCollectionChangedAction.Replace: RemoveInternalChildRange(args.Position.Index, args.ItemUICount); break; case NotifyCollectionChangedAction.Move: RemoveInternalChildRange(args.OldPosition.Index, args.ItemUICount); break; } }更多推荐
虚拟化WPF包装面板问题
发布评论