File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 77 <CollectionView .ItemTemplate>
88 <DataTemplate >
99
10- <Label Text =" Test" />
10+ <Label Text =" {Binding Name}" >
11+ <Label .GestureRecognizers>
12+ <TapGestureRecognizer Command =" {Binding BindingContext.Command}" />
13+ </Label .GestureRecognizers>
14+ </Label >
1115
1216 </DataTemplate >
1317 </CollectionView .ItemTemplate>
Original file line number Diff line number Diff line change 11using System . Collections . ObjectModel ;
2+ using System . Windows . Input ;
23
34namespace MauiCollectionView . Views ;
45
@@ -9,11 +10,23 @@ public PageXamlLeak()
910 InitializeComponent ( ) ;
1011
1112 var collectionView = ( CollectionView ) Content ;
12- collectionView . ItemsSource = new ObservableCollection < string > { "1" , "2" , "3" } ;
13+ collectionView . ItemsSource = new MyModel [ ]
14+ {
15+ "1" , "2" , "3"
16+ } ;
1317 }
1418
1519 ~ PageXamlLeak ( )
1620 {
1721 Console . WriteLine ( "~PageXamlLeak() called" ) ;
1822 }
23+ }
24+
25+ class MyModel
26+ {
27+ public static implicit operator MyModel ( string value ) => new ( ) { Name = value } ;
28+
29+ public string Name { get ; set ; } = "" ;
30+
31+ public ICommand Command { get ; set ; } = new Command ( ( ) => Console . WriteLine ( "Tapped!" ) ) ;
1932}
You can’t perform that action at this time.
0 commit comments