Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work out how to handle lazily-evaluated ItemsControl.Items #54

Closed
grokys opened this issue Jul 12, 2015 · 4 comments · Fixed by #9677
Closed

Work out how to handle lazily-evaluated ItemsControl.Items #54

grokys opened this issue Jul 12, 2015 · 4 comments · Fixed by #9677

Comments

@grokys
Copy link
Member

grokys commented Jul 12, 2015

If a lazily-evaluated IEnumerable is assigned to ItemsControl.Items then stuff breaks, as the sequence gets re-enumerated every time the control accesses the items.

Some possible solutions:

  1. Have two separate properties as in WPF: Items and ItemsSource. This feels a little messy to me, having two properties to do essentially the same thing, and making one read-only in certain situations etc as in WPF.
  2. Change the type of Items from IEnumerable to ICollection.
  3. Throw an exception if value doesn't implement ICollection or IList etc.

@SuperJMN thoughts? Any other ideas?

@danwalmsley
Copy link
Member

In WPF the Items type is ItemsCollection.

ItemCollection : CollectionView, IList, ICollection, 

@grokys
Copy link
Member Author

grokys commented Jul 26, 2016

The Items collection in WPF is a different thing: the equivalent in WPF is ItemsSource which is an IEnumerable.

@grokys grokys added this to the Beta 1 milestone Aug 3, 2016
@kekekeks
Copy link
Member

ItemsControl needs to work with finite enumerables anyway, so we might as well use IList there

@grokys grokys modified the milestones: Beta 1, Beta 2 Oct 18, 2017
@grokys grokys modified the milestones: 0.7.0, 0.9 Apr 7, 2019
@grokys
Copy link
Member Author

grokys commented Feb 3, 2020

We now have ItemsSourceView in the tree (ported from WinUI). We should use this in ItemsControl to handle this issue. Unfortunately this will result in breaking changes (templates will need to bind to the ItemsSourceView instead of Items) so going to fix this as part of other breaking changes in #3388.

@grokys grokys added this to To do in @grokys todos via automation Feb 13, 2021
@grokys grokys moved this from To do to ItemsRepeater as ItemsPresenter in @grokys todos Feb 13, 2021
@maxkatz6 maxkatz6 removed this from the 0.9 milestone Jun 19, 2022
grokys added a commit that referenced this issue Dec 9, 2022
grokys added a commit that referenced this issue Dec 9, 2022
@grokys todos automation moved this from ItemsControl to Done Jan 17, 2023
maxkatz6 pushed a commit that referenced this issue Feb 20, 2023
* Resolve #54, Roslyn and NuGet are broken
* We don't want to break code referencing older SDKs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
@grokys todos
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants