Skip to content

Possible bug: control always sets SelectedIndex the first time #2

@GeertvanHorrik

Description

@GeertvanHorrik

I am trying this control for a media player, and I found a possible issue:

In PrepareContainerForItemOverride:

            if (items.Count == 1)
            {
                IndexSelected(0, false);
            }

But the first time an item is generated, the count is always 1. I think it's better to check the count of the ItemsSource (which already has the right count).

A fix that works on my machine is:

            var itemsSource = ItemsSource as ICollection;
            if (itemsSource != null && itemsSource.Count == 1)
            {
                IndexSelected(0, false);
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions