microsoft / microsoft/microsoft-ui-xaml
ComboBox selected values does not update properly when changing the DataContext at Runtime
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
When changing the DataContext of the ComboBox at runtime, its selected values do not update properly. I have provided bindings for the SelectedIndex and ItemsSource properties, but when the DataContext is changed, the ComboBox values still do not update correctly.
Sample: [MSComboBox.zip](https://github.com/user-attachments/files/17502903/MSComboBox.zip)
### Steps to reproduce the bug
1. Run the Sample.
2. Click on "Reset DataContext" button.
### Expected behavior
The Combo Box value should be updated based on selected index.
### Screenshots
https://github.com/user-attachments/assets/f5f01edb-b85c-4f09-9c01-ed6c69d99590
### NuGet package version
WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002
### Windows version
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Start by running the attached MSComboBox.zip sample and reproduce the issue with the Reset DataContext button. Inspect the ComboBox bindings for SelectedIndex and ItemsSource and compare the selected value before and after the DataContext change. Done means the ComboBox value updates to match the selected index after the reset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100