【发布时间】:2019-01-03 10:16:54
【问题描述】:
我有以下代码可以转换 wpf TabControl 的 Items 集合中的项目:
public IReadOnlyReactiveList<MyType> MyItems => base.Items.OfType<MyType>().CreateDerivedCollection(_ => _);
IReadOnlyReactiveList 和 CreateDerivedCollection 扩展都被标记为已过时。
base.Items collection is of type `ItemCollection`.
我不知道如何用动态数据替换对 CreateDerivedCollection 的调用并保留功能。 MyItems 列表每次都需要更新,然后基础项目集合发生变化。
【问题讨论】:
-
顺便说一句,不确定 OfType
是否会在旧版本中完成您想要的操作。它不会根据 base.Items 的变化而更新,因为它删除了任何可观察性。
标签: c# wpf dynamic-data reactiveui