2017-04-18 07:52:04 +08:00
|
|
|
## ListBoxItem IsSelected binding issue with ObservableCollection<T>.Move
|
2017-04-06 04:52:19 +08:00
|
|
|
|
|
|
|
### Scope
|
|
|
|
Minor
|
|
|
|
|
|
|
|
### Version Introduced
|
|
|
|
4.5
|
|
|
|
|
|
|
|
### Version Reverted
|
|
|
|
4.6
|
|
|
|
|
|
|
|
### Source Analyzer Status
|
|
|
|
Planned
|
|
|
|
|
|
|
|
### Change Description
|
2017-04-21 02:19:05 +08:00
|
|
|
|
|
|
|
Calling <xref:System.Collections.ObjectModel.ObservableCollection`1.Move(System.Int32,System.Int32)>
|
|
|
|
or
|
|
|
|
<xref:System.Collections.ObjectModel.ObservableCollection`1.MoveItem(System.Int32,System.Int32)>
|
|
|
|
on a collection bound to a
|
|
|
|
<xref:System.Windows.Controls.ListBox?displayProperty=name> with items selected
|
|
|
|
can lead to erratic behavior with future selection or unselection of
|
|
|
|
<xref:System.Windows.Controls.ListBox?displayProperty=name> items.
|
2017-04-06 04:52:19 +08:00
|
|
|
|
|
|
|
- [ ] Quirked
|
|
|
|
- [ ] Build-time break
|
|
|
|
|
|
|
|
### Recommended Action
|
2017-04-21 02:19:05 +08:00
|
|
|
|
|
|
|
Calling <xref:System.Collections.ObjectModel.Collection`1.Remove(`0)?displayProperty=name>
|
|
|
|
and
|
|
|
|
<xref:System.Collections.ObjectModel.Collection`1.Insert(System.Int32,`0)?displayProperty=name>
|
|
|
|
instead of
|
|
|
|
<xref:System.Collections.ObjectModel.ObservableCollection`1.Move(System.Int32,System.Int32)>
|
|
|
|
will work around this issue. Alternatively, this issue has been fixed in the
|
|
|
|
.NET Framework 4.6 and may be addressed by upgrading to that version of the .NET
|
|
|
|
Framework.
|
2017-04-06 04:52:19 +08:00
|
|
|
|
|
|
|
### Affected APIs
|
|
|
|
* ``M:System.Collections.ObjectModel.ObservableCollection`1.Move(System.Int32,System.Int32)``
|
|
|
|
* ``M:System.Collections.ObjectModel.ObservableCollection`1.MoveItem(System.Int32,System.Int32)``
|
|
|
|
|
|
|
|
### Category
|
|
|
|
Windows Presentation Foundation (WPF)
|
|
|
|
|
|
|
|
[More information](http://social.msdn.microsoft.com/Forums/en-US/afcbc8b3-a2f2-41e4-b402-2efc9eab1ffe/listboxitem-isselected-binding-issue-with-observablecollectiontmove?forum=wpf)
|
|
|
|
|
2017-04-18 07:52:04 +08:00
|
|
|
<!-- breaking change id: 102 -->
|