-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc55f63
commit 43af9ec
Showing
2 changed files
with
20 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,45 @@ | ||
| ||
using System.Collections.ObjectModel; | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
|
||
namespace MauiApp1 | ||
{ | ||
public partial class MainPage : ContentPage | ||
{ | ||
List<WeakReference> references = new List<WeakReference>(); | ||
|
||
|
||
public MainPage() | ||
{ | ||
InitializeComponent(); | ||
|
||
listView.ItemTemplate = new DataTemplate(() => | ||
{ | ||
var cell = new ViewCell { View = new Label() }; | ||
references.Add(new(cell.View)); | ||
return cell; | ||
}); | ||
} | ||
|
||
void Log() | ||
{ | ||
Debug.WriteLine($"CheckBox's alive: {references.Count(l => l.IsAlive)}"); | ||
} | ||
|
||
private void ItemSource_One_Button_Clicked(object sender, EventArgs e) | ||
{ | ||
GC.Collect(); | ||
Log(); | ||
listView.ItemsSource = employeeInfoRepository.EmployeesInfo1; | ||
|
||
} | ||
|
||
private void ItemSource_Two_Button_Clicked(object sender, EventArgs e) | ||
{ | ||
listView.ItemsSource = employeeInfoRepository.EmployeesInfo2; | ||
GC.Collect(); | ||
Log(); | ||
listView.ItemsSource = employeeInfoRepository.EmployeesInfo2; | ||
} | ||
} | ||
} |