Example of XAML Usage in ListView with ListViewCachingStrategy.RecycleElement enabled using normal ViewCell
See original GitHub issueI tried following instructions on this page and that page too but both show code-behind implementation (non XAML). In case of XAML, if I have the following list view
with normal view cell
, what should I do to set OnBindingContextChanged
of ViewCell to be compatible with Recycle
Caching Strategy?
<ListView x:Name="listView" CachingStrategy="RecycleElement">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal">
<ffimageloading:CachedImage HorizontalOptions="Center" VerticalOptions="Center" WidthRequest="300" HeightRequest="300" DownsampleToViewSize="true" />
<Label Text="{Binding Name}"/>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Thanks
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
ListView Performance - Xamarin
When a ListView uses a DataTemplateSelector to select a DataTemplate , the RecycleElement caching strategy does not cache DataTemplate s.
Read more >ListViewCachingStrategy Enum (Xamarin.Forms)
Indicates that, in addition to the behavior specified by RecycleElement, DataTemplate objects that are selected by a DataTemplateSelector are cached by the data ......
Read more >Creating Custom Controls Part 1: ExtendedListView Endless ...
Our first use case to dive into creating custom controls will be the ... public ExtendedListView(ListViewCachingStrategy cachingStrategy) ...
Read more >Xamarin.Forms, iOS only, Content of a frame that is the ...
Forms version (4.7.0.1080) and now a list view I have in my project is totally messed up - the template of the list...
Read more >CachingStrategy="RecycleElement", ListView Performance ...
I tried to set it on the RADListView but got no property found. I am using the grid layout format for the ListView....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@daniel-luberda Maybe wiki could be improved regarding Recycle strategy? So we have the XAML example too
@Korayem You should create separate XAML view for a cell (separate file: Add File -> Forms ContentView XAML), then use it in your page:
Then override
OnBindingContextChanged
method inYourCustomView.xaml.cs
file.