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

Alternate color of items when items are added or removed #1852

Merged
merged 8 commits into from
Mar 20, 2018

Conversation

skendrot
Copy link
Contributor

Issue: #1837

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

When an item is added or removed from a list, the item itself gets the correct color but items below it do not update

What is the new behavior?

When an item is inserted or removed the background color will update for that item and all items below it

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Contains NO breaking changes

Other information

Change also unsubscribes from all events for the ListViewBase control.

@skendrot
Copy link
Contributor Author

Anyone know why we're not using the ItemIndex property? Is this not available in older SDKs?

Example of where we are not using it, but could: https://github.com/skendrot/UWPCommunityToolkit/blob/5c4a58823496ac446b5879b54db27b3d3a3f1277/Microsoft.Toolkit.Uwp.UI/Extensions/ListViewBase/ListViewExtensions.cs#L129

@nmetulev
Copy link
Contributor

I don't think there is a reason, and it's probably a good optimization to use ItemIndex

@skendrot
Copy link
Contributor Author

I can add it to this PR if it's available in older SDKs

@nmetulev
Copy link
Contributor

The docs say it's available starting in 10240 - it should be ok

@nmetulev
Copy link
Contributor

@skendrot, were you planing on adding the ItemIndex property here?

@skendrot
Copy link
Contributor Author

Yup, I'll get that in

@@ -22,6 +24,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
/// </summary>
public static class ListViewExtensions
{
private static Dictionary<IObservableVector<object>, Windows.UI.Xaml.Controls.ListViewBase> _itemsForList = new Dictionary<IObservableVector<object>, Windows.UI.Xaml.Controls.ListViewBase>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make using Windows.UI.Xaml.Controls and remove useless code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fully qualify because of the ListViewBase extensions class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Fair.

@Odonno Odonno merged commit 5e7fb51 into CommunityToolkit:master Mar 20, 2018
@windowstoolkitbot
Copy link

This PR is linked to unclosed issues. Please check if one of these issues should be closed: #1837

@HppZ HppZ mentioned this pull request Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants