[API Proposal]: Expose SelectedItemsImplProperty in MultiSelector
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Background and motivation
When inheriting from `MultiSelector`, it is currently not possible to use `SelectedItems` in bindings because the underlying `DependencyProperty` is not exposed.
### API Proposal
Add the following to `MultiSelector`.
The `ListBox` inherits from `Selector` and has this code.
```csharp
///
/// A read-only IList containing the currently selected items
///
public static readonly DependencyProperty SelectedItemsProperty = Selector.SelectedItemsImplProperty;
```
### API Usage
```xaml
```
Currently this will fail `error MC3011: Cannot find the static member 'SelectedItemsProperty' on the type 'MyMultiSelector'`
### Alternative Designs
At least make `SelectedItemsImplProperty` protected.
```csharp
protected internal static readonly DependencyProperty SelectedItemsImplProperty =
SelectedItemsPropertyKey.DependencyProperty;
```
### Risks
I don't think there are risks. The `ListBox` does the same thing.
Actually `ListBox` could inherit from `MultiSelector`. `ListBox` currently seems to duplicate the code in `MultiSelector`.
However the latter could pose some small risk, if existing code checks for `control is MultiSelector` and does not expect a `ListBox`.
Contributor guide
Assessment
This issue has not been assessed yet.