问题标签 [collectionview]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
679 浏览

wpf - 绑定到集合是如何真正起作用的?

好吧,我很困惑。

ItemsSource如果我的控件具有类型的依赖属性IEnumerable并且用户将集合绑定到它我有什么对象DependencyPropertyChangedEventArgs.NewValue

据我所知CollectionView,它是为集合隐式创建的,我希望args.NewValue是 type ICollectionView

这个博客

当用户将 WPF 属性绑定到数据集合时,WPF 会自动创建一个视图来包装该集合,并将该属性绑定到视图,而不是原始集合。这种行为总是发生,并且独立于 CollectionViewSource。

但是调试器(VS 2012,.net v.4.0)显示我收到原始原始集合在NewValue. (BindsDirectlyToSource 未设置,默认为 false)
这怎么可能?!

我无法理解在这种情况下 WPF 控件如何支持排序、分组和过滤。
CollectionView 如何以及何时注入和使用?

0 投票
0 回答
735 浏览

wpf - Datagrid刷新组/排序collectionview

我想刷新我的数据网格,但刷新后,我在组内的排序不再正确......

我调用了一个按钮,该按钮引用了一种执行刷新的方法:

0 投票
1 回答
553 浏览

wpf - wpf 数据网格度假村错误

我现在被困在这里 3 周了,我快死了 :-)

当我刷新我的收藏时,SortDescription 不起作用。这是我在互联网上阅读的 wpf 中的一个已知错误。

但我似乎无法让它工作......我的经验似乎并不那么远:-)有人可以帮助我并告诉我如何重新排序我的数据网格......

xml:

我通过代码绑定数据提供者,它是我从互联网 url 获取的 xml 文件。

CS:

0 投票
2 回答
418 浏览

c# - 计数集合中的项目数

如何计算等于某个值的项目并将其放在标签中?

在 Readen 属性中,存在等于“1”或“0”的值。如何计算每个等于“1”的Readen?

更新;

在会话完成后尝试了这个调用:

MessageBox 显示为零

0 投票
1 回答
5120 浏览

xcode - 集合视图单元格不允许我选择

这可能是一个非常容易解决的问题;我一直在阅读无数的论坛和教程,似乎无法找到答案。

在我的应用程序中,我有一个弹出集合视图来选择特定选项并返回一个值...

但是它不会突出显示或选择?我可以看到 NS 日志输出从不显示选择或数据传递。

这是我的代码...

集合.h 文件

}

}

0 投票
0 回答
665 浏览

ember.js - Ember CollectionView - 删除 ItemView

我很难找到答案,所以也许我做错了。我有一个带有项目视图类的集合视图。每个项目都有一个删除按钮,它指的是动作“removeItem”。这确实删除了该项目,但我需要参考集合视图内容,以便通过 API 调用发布更新后的数组。

编辑:

我找到了这个特定问题的答案。集合视图上有一个属性需要由项目类访问。我可以使用 this.get("parentView") 访问它。此外,我必须将视图添加为 removeItem 操作的目标。

它看起来像这样:

0 投票
1 回答
4270 浏览

ios - objective-c collectionview 不加载数据

不知何故,我的 collectionView 不加载我的数据。我从 facebook 获取数据并在填充数组后调用 reloadData,但没有任何反应......

不显示单元格,因为调用 ViewDidLoad 时数组为 0。

如何重新加载它对 collectionView 生效?我的代码有什么问题?

集合视图控制器.h

集合视图控制器.m

调试输出:

干杯

0 投票
1 回答
372 浏览

uicollectionview - 让 uicollectionview 在第二个单元格上开始

我有一个基于行的集合视图,每个单元格占据整个屏幕。如何让 collectionview 从第二个单元格开始?我是收藏视图和 iOS 的菜鸟。

[ 0 ] | [ 1 ] | [ 2 ] | [ 3 ]

所以你一次只能看到一个单元格,我希望它在用户到达集合视图后立即从 indexpath.row 1 开始

0 投票
1 回答
1288 浏览

wpf - WPF with UI threading issues - TaskFactory, CollectionView issues - syntax nightmare

See bottom of post for my pseudo solution.

Once again I'm completely and utterly stuck on this. I've burned hours trying to understand - and yes I can get a single collectionviewsource to work beautifully with nothing about threading on the code behind.

Imagine my shock when I found merely adding two collectionviewsources on the page causes threading issues. I've spent a few hours last night reading Async in C#5 and the MSDN stuff however I get into work today and I can't decipher how to make this happen.

The code below is the last attempt I've made before whining for help as I've burnt, possibly, a bit too much work time on attempting to understand how to do this. I understand that I need one collectionviewsource to complete before starting the other, so I tried Await Task.ContinueWith etc to try and chain one after the other.

Lining up both sets of tasks in the threads correctly seems to be quite tricky, or I'm still misunderstanding something fundemental.

If anyone can advise how they would asynchronously populate a few controls on a WPF UI I would be very grateful.

The application itself is a throwaway application, linked to an Access database that I'm using to try and become fluent enough in threading to implement it in our proper code base. I'm long way off that!

Updated with more complete code samples and the adjustments made according to answers:

The ObservableCollectionEx class:

Please note, I can't translate this class to VB due to requiring an Event Override. Another variation I've tried, but falls foul of thread ownership again. The two collectionviews thing isn't yielding to a solution: I don't know if it's because the underlying collection isn't good for it or whether in reality it wasn't meant to work that way. I get close but no cigar.

I found a way to do it, based on a combination of feedback and research this morning. Building the two collectionviews asynchronously itself is somewhat impractical given the STAThread model of WPF. However, merely ensuring one HAS completed and shifting some of the async out of one entity class has made this plausible.

Instead I fire off the first task, who's underlying class does build it's data with its own Async method. Then test to see if it has completed before allowing the second collectionview to be fired off. This way I don't need to worry about context or dispatcherobjects. The second collection does not use any async.

This is an experimental project for concept research really. As it happens, the idea I'd want two such lists built this way isn't as useful as all that but I do see where being able to compose a data heavy interface asynchronously could be handy.

0 投票
1 回答
164 浏览

c# - 过滤时更改 ListView 中项目的属性时出现问题

我有一个可以过滤的项目列表。Item 类有一个属性 IsChecked。有时,如果我在过滤列表时更改此属性(在运行时通过复选框),它不会在我的源集合中更改它。我做错了吗?