Microsoft .NET MAUI part9 [Xamarin]at TECH
Microsoft .NET MAUI part9 [Xamarin] - 暇つぶし2ch57:デフォルトの名無しさん
22/09/20 23:29:09.65 tcmFdYIT.net
プロジェクト作って、
MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="<URLリンク(schemas.microsoft.com) xmlns:x="<URLリンク(schemas.microsoft.com) xmlns:local="clr-namespace:CollectionViewMemoryLeak" x:Class="[プロジェクト名].MainPage" x:DataType="local:MainPage"> <Grid RowDefinitions="Auto,*"> <Button Text="Replace" Clicked="Button_Clicked"/> <CollectionView Grid.Row="1" ItemsSource="{Binding Items}"> <CollectionView.ItemTemplate> <DataTemplate> <Label Text="{Binding}"/> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> </Grid> </ContentPage>
MainPage.xaml.cs
using System.Collections.ObjectModel; namespace [プロジェクト名]; public partial class MainPage : ContentPage { public ObservableCollection<string> Items { get; } = new() { "a" }; public MainPage() { InitializeComponent(); BindingContext = this; } private void Button_Clicked(object sender, EventArgs e) { Items[0] += "b"; } }
って置き換えて、デバッグ開始
ボタン1万回ぐらい押すとわかると思うよ


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch