@@ -14,36 +14,12 @@ public partial class StructuredItemsViewHandler<TItemsView> : ItemsViewHandler<T
1414
1515 public static void MapHeaderTemplate ( StructuredItemsViewHandler < TItemsView > handler , StructuredItemsView itemsView )
1616 {
17- // Only call UpdateAdapter if adapter is not yet set up, otherwise the adapter's property listener handles it
18- var recyclerView = handler . PlatformView as IMauiRecyclerView < TItemsView > ;
19- if ( recyclerView != null )
20- {
21- // Check if this is a RecyclerView and if the adapter is already set
22- if ( handler . PlatformView is RecyclerView androidRecyclerView && androidRecyclerView . GetAdapter ( ) != null )
23- {
24- // Adapter is already set, the adapter's property change listener will handle this more efficiently
25- return ;
26- }
27- // Adapter not set yet, need to use UpdateAdapter for initial setup
28- recyclerView . UpdateAdapter ( ) ;
29- }
17+ ( handler . PlatformView as IMauiRecyclerView < TItemsView > ) ? . UpdateAdapter ( ) ;
3018 }
3119
3220 public static void MapFooterTemplate ( StructuredItemsViewHandler < TItemsView > handler , StructuredItemsView itemsView )
3321 {
34- // Only call UpdateAdapter if adapter is not yet set up, otherwise the adapter's property listener handles it
35- var recyclerView = handler . PlatformView as IMauiRecyclerView < TItemsView > ;
36- if ( recyclerView != null )
37- {
38- // Check if this is a RecyclerView and if the adapter is already set
39- if ( handler . PlatformView is RecyclerView androidRecyclerView && androidRecyclerView . GetAdapter ( ) != null )
40- {
41- // Adapter is already set, the adapter's property change listener will handle this more efficiently
42- return ;
43- }
44- // Adapter not set yet, need to use UpdateAdapter for initial setup
45- recyclerView . UpdateAdapter ( ) ;
46- }
22+ ( handler . PlatformView as IMauiRecyclerView < TItemsView > ) ? . UpdateAdapter ( ) ;
4723 }
4824
4925 public static void MapItemsLayout ( StructuredItemsViewHandler < TItemsView > handler , StructuredItemsView itemsView )
0 commit comments