File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 TextTransform =" None" />
2121 </Grid >
2222
23- <ListView
23+ <CollectionView
2424 x : Name =" LvExamples"
2525 Grid.Row=" 1"
26- GroupDisplayBinding =" {Binding Category}"
27- IsGroupingEnabled =" true"
28- ItemSelected =" ListView_OnItemSelected"
26+ IsGrouped =" true"
2927 ItemsSource =" {Binding Examples}" >
30- <ListView .ItemTemplate>
28+ <CollectionView .ItemsLayout>
29+ <LinearItemsLayout Orientation =" Vertical"
30+ ItemSpacing =" 8" />
31+ </CollectionView .ItemsLayout>
32+ <CollectionView .GroupHeaderTemplate>
33+ <DataTemplate x : DataType =" oxyplotMauiSample:ExampleGroup" >
34+ <Label Text =" {Binding Category}"
35+ BackgroundColor =" Gray"
36+ FontSize =" 20"
37+ FontAttributes =" Bold" />
38+ </DataTemplate >
39+ </CollectionView .GroupHeaderTemplate>
40+ <CollectionView .ItemTemplate>
3141 <DataTemplate x : DataType =" exampleLibrary:ExampleInfo" >
32- <TextCell Text =" {Binding Title}" />
42+ <Label Text =" {Binding Title}" FontSize =" 18" >
43+ <Label .GestureRecognizers>
44+ <TapGestureRecognizer Tapped =" CollectionView_OnItemTapped"
45+ NumberOfTapsRequired =" 1" />
46+ </Label .GestureRecognizers>
47+ </Label >
3348 </DataTemplate >
34- </ListView .ItemTemplate>
35- </ListView >
49+ </CollectionView .ItemTemplate>
50+ </CollectionView >
3651 </Grid >
37- </ContentPage >
52+ </ContentPage >
Original file line number Diff line number Diff line change @@ -23,12 +23,10 @@ protected override void OnAppearing()
2323 this . BindingContext = _viewModel ;
2424 }
2525
26- private async void ListView_OnItemSelected ( object sender , SelectedItemChangedEventArgs e )
26+ private async void CollectionView_OnItemTapped ( object sender , TappedEventArgs e )
2727 {
28- if ( e . SelectedItemIndex < 0 )
29- return ;
30-
31- var exampleInfo = e . SelectedItem as ExampleInfo ;
28+ var lbl = ( Label ) sender ;
29+ var exampleInfo = lbl . BindingContext as ExampleInfo ;
3230 var page = new PlotViewPage
3331 {
3432 ExampleInfo = exampleInfo
Original file line number Diff line number Diff line change 55 xmlns : x =" http://schemas.microsoft.com/winfx/2009/xaml"
66 xmlns : oxyplotMauiSample =" clr-namespace:OxyplotMauiSample"
77 Title =" Select demo" >
8- <ListView
8+ <CollectionView
99 x : Name =" list1"
1010 HorizontalOptions =" Fill"
11- ItemTapped =" ListView_OnItemTapped"
1211 VerticalOptions =" Fill" >
13- <ListView .ItemTemplate>
12+ <CollectionView .ItemTemplate>
1413 <DataTemplate x : DataType =" oxyplotMauiSample:DemoInfo" >
15- <TextCell Detail =" {Binding Details}"
16- Text =" {Binding Title}" />
14+ <Grid Padding =" 10" >
15+ <Grid .RowDefinitions>
16+ <RowDefinition Height =" Auto" />
17+ <RowDefinition Height =" Auto" />
18+ </Grid .RowDefinitions>
19+ <Label Grid.Row=" 0" Text =" {Binding Title}" FontAttributes =" Bold" />
20+ <Label Grid.Row=" 1" Text =" {Binding Details}" FontSize =" Small" TextColor =" Gray" />
21+ <Grid .GestureRecognizers>
22+ <TapGestureRecognizer Tapped =" CollectionView_OnItemTapped"
23+ NumberOfTapsRequired =" 1" />
24+ </Grid .GestureRecognizers>
25+ </Grid >
1726 </DataTemplate >
18- </ListView .ItemTemplate>
19- </ListView >
27+ </CollectionView .ItemTemplate>
28+ </CollectionView >
2029</ContentPage >
Original file line number Diff line number Diff line change @@ -20,9 +20,10 @@ public IssueDemoPage()
2020 this . list1 . ItemsSource = demoPages ;
2121 }
2222
23- private async void ListView_OnItemTapped ( object sender , ItemTappedEventArgs e )
23+ private async void CollectionView_OnItemTapped ( object sender , TappedEventArgs e )
2424 {
25- var demoInfo = ( DemoInfo ) e . Item ;
25+ var grid = ( Grid ) sender ;
26+ var demoInfo = ( DemoInfo ) grid . BindingContext ;
2627 var page = demoInfo . CreatePage ( ) ;
2728 page . Title = demoInfo . Title ;
2829 await Navigation . PushAsync ( page ) ;
Original file line number Diff line number Diff line change 163163 </Setter >
164164 </Style >
165165
166- <Style TargetType =" ListView" >
167- <Setter Property =" SeparatorColor" Value =" {AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
168- <Setter Property =" RefreshControlColor" Value =" {AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
169- </Style >
170-
171166 <Style TargetType =" Picker" >
172167 <Setter Property =" TextColor" Value =" {AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
173168 <Setter Property =" TitleColor" Value =" {AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
You can’t perform that action at this time.
0 commit comments