Menu items do not have position information when created via ItemsSource
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
When a menu is populated with menu items in XAML, Windows Narrator can get the position info of each menu item and will announce them when focused.
However, when the menu items are generated from `ItemsSource`. The narrator won't be able to get position info and therefore won't announce it
```
```
More specifically, `MenuItemAutomationPeer` throws exceptions in `GetPositionInSet` and `GetSizeOfSet` if `ItemsSource` is used.
### Reproduction Steps
1. Create a menu with `ItemsSource` bound to a collection of string
2. Run the application.
3. Run Windows Narrator
4. Tab over the menu items
### Expected behavior
The narrator should announce the header of a menu item as well as its position, e.g. 3 of 5
### Actual behavior
Only the header is announced by the narrator
### Regression?
_No response_
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.