Skip to content

Commit 5a99135

Browse files
committed
TransferList TransferAll Affects Only Searched Item
1 parent 6b2235b commit 5a99135

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

CodeBeam.MudBlazor.Extensions/Components/ListExtended/MudListExtended.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ protected internal ValueTask ScrollToMiddleAsync(MudListItemExtended<T?>? item)
16531653
///
16541654
/// </summary>
16551655
/// <returns></returns>
1656-
protected ICollection<T?>? GetSearchedItems()
1656+
protected internal ICollection<T?>? GetSearchedItems()
16571657
{
16581658
if (!SearchBox || ItemCollection == null || _searchString == null)
16591659
{

CodeBeam.MudBlazor.Extensions/Components/TransferList/MudTransferList.razor.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,24 +340,23 @@ protected internal async Task TransferAll(bool startToEnd = true)
340340
}
341341
if (startToEnd == true)
342342
{
343-
foreach (var item in StartCollection)
343+
344+
foreach (var item in _startList.GetSearchedItems() ?? [])
344345
{
345-
EndCollection.Add(item);
346+
EndCollection?.Add(item);
347+
StartCollection?.Remove(item);
346348
}
347-
StartCollection.Clear();
348-
_startList.Clear();
349349
OrderItems();
350350
await EndCollectionChanged.InvokeAsync(EndCollection);
351351
await StartCollectionChanged.InvokeAsync(StartCollection);
352352
}
353353
else if (startToEnd == false)
354354
{
355-
foreach (var item in EndCollection)
355+
foreach (var item in _endList.GetSearchedItems() ?? [])
356356
{
357-
StartCollection.Add(item);
357+
StartCollection?.Add(item);
358+
EndCollection?.Remove(item);
358359
}
359-
EndCollection.Clear();
360-
_endList.Clear();
361360
OrderItems();
362361
await StartCollectionChanged.InvokeAsync(StartCollection);
363362
await EndCollectionChanged.InvokeAsync(EndCollection);

0 commit comments

Comments
 (0)