Skip to main content
 首页 » 编程设计

c#之SemanticZoom ZoomedOutView SelectedItems 返回 DependencyObject

2024年02月20日8kevingrace

在 SemanticZoom 控件中,我对放大和缩小 View 使用相同的 CollectionViewSource。为此,我在后面的代码中绑定(bind)了缩小的 GridView,如下所示:

(FavoriteGroupsSemanticZoom.ZoomedOutView as ListViewBase).ItemsSource = this.FavoriteGroupsViewSource.View.CollectionGroups; 

一切都按预期进行。但是,现在缩小的 GridView 绑定(bind)到 DependencyObjects 列表而不是我原来的组。因此,当我访问 SelectedItems 时,我得到一个 WinRT 对象,其中包含 DependencyObjects 列表而不是我的组。

如何访问缩小的 GridView 的选定组?

请您参考如下方法:

您将依赖对象转换为 ICollectionViewGroup它具有 Group 和 GroupItems 属性。