-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
When a ComboBox's data source is bound to an ImmutableArray, its value is reset when it loses focus. #11602
Comments
@Olina-Zhang can your team please test? Related StackOverflow post: |
@elachlan |
@Tanya-Solyanik The core of the problem lies in the immutable nature of Also, defining Workaround: For data binding scenarios in WinForms, it is advisable to use Here is a modified snippet of public ObservableCollection<int> Values2 { get; }
public MainModel()
{
var values = new[] { 1, 2, 3 };
Values1 = values.ToImmutableArray();
Values2 = new ObservableCollection<int>(values);
} This approach ensures that the |
Closing this issue as it is not a regression from .NET Framework and @ricardobossan was able to provide a workaround to the customer. We can always revisit if we get more reports of customer impact. |
.NET version
net8.0-windows
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
not tested
Issue description
When a ComboBox is bound to a data source of type ImmutableArray, the selected value resets to the initial value upon losing focus.
This issue does not occur if the ImmutableArray is exposed as an IReadOnlyList.
This issue also occur in .Net 4.8.1 with the System.Collections.Immutable v8.0.0 package.
A minimal reproducible example is available here.
Steps to reproduce
At this point the first item is selected back.
The text was updated successfully, but these errors were encountered: