提交 2fe31a94 编写于 作者: S Sam Bent

Selector doesn't change selection properties when disconnected

上级 92345c38
......@@ -1110,6 +1110,16 @@ internal virtual void UnselectAllImpl()
/// <param name="e">Information about what has changed</param>
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
{
base.OnItemsChanged(e);
// if the selector is disconnected, don't do any more work - it
// wouldn't help, and could actually hurt, e.g. by sending bad
// values through bindings attached to the selection properties.
if (DataContext == BindingExpressionBase.DisconnectedItem)
{
return;
}
// When items become available, reevaluate the choice of algorithm
// used by _selectedItems.
if (e.Action == NotifyCollectionChangedAction.Reset ||
......@@ -1119,8 +1129,6 @@ protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
ResetSelectedItemsAlgorithm();
}
base.OnItemsChanged(e);
// Do not coerce the SelectedIndexProperty if it holds a DeferredSelectedIndexReference
// because this deferred reference object is guaranteed to produce a pre-coerced value.
// Also if you did coerce it then you will lose the attempted performance optimization
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册