Browse Source
Merge branch 'master' into alloc-priorityobjects
pull/3015/head
Dariusz Komosiński
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
4 deletions
-
src/Avalonia.Controls/Repeater/ViewManager.cs
|
|
|
@ -128,8 +128,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
private void MoveFocusFromClearedIndex(int clearedIndex) |
|
|
|
{ |
|
|
|
IControl focusedChild = null; |
|
|
|
var focusCandidate = FindFocusCandidate(clearedIndex, focusedChild); |
|
|
|
var focusCandidate = FindFocusCandidate(clearedIndex, out var focusedChild); |
|
|
|
if (focusCandidate != null) |
|
|
|
{ |
|
|
|
focusCandidate.Focus(); |
|
|
|
@ -145,7 +144,7 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
IControl FindFocusCandidate(int clearedIndex, IControl focusedChild) |
|
|
|
IControl FindFocusCandidate(int clearedIndex, out IControl focusedChild) |
|
|
|
{ |
|
|
|
// Walk through all the children and find elements with index before and after the cleared index.
|
|
|
|
// Note that during a delete the next element would now have the same index.
|
|
|
|
@ -183,7 +182,7 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
// TODO: Find the next element if one exists, if not use the previous element.
|
|
|
|
// If the container itself is not focusable, find a descendent that is.
|
|
|
|
|
|
|
|
focusedChild = nextElement; |
|
|
|
return nextElement; |
|
|
|
} |
|
|
|
|
|
|
|
|