microsoft / microsoft/microsoft-ui-xaml

Proposal: Enable ItemsView selection via binding

Open
#10,504 0 comments 6 reactions 0 assignees View on GitHub
area-ItemsView feature proposal
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

# Proposal: Enable ItemsView selection via binding
Currently the `ItemsView` only enables selection by index, and it's achieved by calling `itemsView.Select(index)`. Please convert the currently read-only `SelectedItem` and `SelectedItems` properties to dependency properties so we can bind to them efficiently and in a loosely coupled way from the view-model.

## Summary
The only way to invoke a selection of items in the `ItemsView` is by calling `itemsView.Select(index)` or `itemsView.SelectAll()`. There should be a better more MVVM-friendly way to achieve that.

## Rationale

* ItemsView is not MVVM-ready
* ItemsView should enable selection via binding

## Scope

| Capability | Priority |
| :---------- | :------- |
| `ItemsView.SelectedItem` should be a read-write dependency property | Must |
| `ItemsView.SelectedItems` should either be a read-write dependency property or become a modifiable `ObservableCollection` | Must |

Contributor guide

Open the contributing guide

Research direction

Start by locating the ItemsView implementation and the existing SelectedItem, SelectedItems, Select(index), and SelectAll APIs. Inspect how selection state is currently stored and exposed. Done means the requested selection properties support binding as described in the scope, with selection behavior covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.