Hi all,
I'm migratin my app from XF.
I have a SfList v27.1.48 with grid layout and 30 items inside a scrollview and IsScrollingEnabled="False".
I can see, even in release mode, that the list doesn't scroll well when I'm updating the content of some or all items stored in a ObservableCollection (eg the label name or the loading control that I have in each list item template using binding).
Then, when the loading ends, the list scroll fast. In XF there wasn't this issue and also during the items update the list was scrolling well.
Can you have a look?
please test on a real device not a simulator.
In order to test create a ObservableCollection with 30 items and a bool property IsBusy inside each item.
In the UI put a binding to this property with a loading control and then use this code:
Items .ForEach(i => { i.IsBusy = true; });
foreach (var item in Items)
{
item.IsBusy= false;
await Task.Run(() => Thread.Sleep(1000));
}
If you continue to scrool you can see a freeze every second when the code update the propery IsBusy.
thanks
Hi Luca,
We have checked the reported query and prepare a simple sample based on the provided information. We have tested the sample with real device and the scrolling is working as expected. For your reference we have attached our video . Could you please share more details about the issue , that how you are loading the items or could you please modify our attached sample that we missed anything . This is help us to validate the issue and provide a solution as soon as possible.
Regards,
KamalaKannan S.
hi all,
after hours i got the issue.
It's due to IconTintColorBehavior that i have in many images in the item template of the list.
Can you check if it's related to your library or to MAUI 8.0.82 please?
thanks
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="{Binding ImageColor}"
/>
</Image.Behaviors>
Hi,
after reviewing my code now is better. Sorry.
The only bug is IconTintColorBehavior when used in your list.
What happens is that after changing some items image color, then filtering or scrolling, the color is not applied to the correct item but to a random one in the list.
Can you check if it's related to your library or to
CommunityToolkit.Maui
please?
thanks
Hi all,
after hours I'm able to replicate the issue.
the issue is related to IconTintColorBehavior used in your list with template selector.
In attachedf the zip with code and video.
How to replicate:
We have 2 possible scenario:
Item not tapped= black background and black image color
Item tapped= red background and yellow image color
Random tap on some items.
then randon filter tapping on 1,2,3 multiple time
then click an all
as you can see same images lose color setting.
We have red background but black image color or black background and yellow image color.
Seems that the IconTintColorBehavior is applied to wrong item index.
This happens on both ios and android.
I tested the same code but with a standard maui ListView and it works.
Can you check please why with your control it doesn't work?
thanks
Attachment: ListViewSample_eddf6420.zip
Hi Luca,
Regarding ListView Performance Issues:
We have reviewed the attached sample and noticed that IsScrollingEnabled is set to False. In this scenario, the SfListView's virtualization is disabled, and the ScrollView provided by .NET MAUI handles the scrolling. We suspect the issue may be related to the IconTintColorBehavior. We are currently investigating this, and we will update you with more information once we have further details.
Regarding Incorrect Icon TintColor:
The tint color is not updating correctly when the ItemsSource collection changes. To resolve this, we recommend setting the CachingStrategy to CreateNewTemplate.
Please refer the attached code snippet:
|
<syncfusionLV:SfListView x:Name="listView" ItemsSource="{Binding ContactsInfo}" TapCommand="{Binding Path=BindingContext.SelectCommand, Source={x:Reference Name=listView}}" TapCommandParameter="{Binding ContactName}" SelectionBackground="Transparent" ItemSpacing="5" IsScrollingEnabled="False" ItemSize="120" Grid.Row="1" CachingStrategy="CreateNewTemplate" ItemTemplate="{StaticResource templateSelector}"> <syncfusionLV:SfListView.ItemsLayout> <syncfusionLV:GridLayout SpanCount="3"></syncfusionLV:GridLayout> </syncfusionLV:SfListView.ItemsLayout>
</syncfusionLV:SfListView> |
Please let us know if you have any other queries.
Regards,
Jayashree
Hi,
thanks for your quick reply.
Using CachingStrategy="CreateNewTemplate" the color image works but I can see that the filtering is slower (much slower, on android it keeps 4 second to filter on tab 1, this is not acceptable considering that the UI is very simple. Also Ios performance are worse) and now in android the app crash sometimes on filtering (attached to the end the exception)
Of course, using RecycleTemplate is better for performance.
I have the same code in Xamarin Forms and it works without using CachingStrategy="CreateNewTemplate".
I think there is something related to IconTintColorBehavior because all other components (background, label color ecc...) are updated correctly even without CachingStrategy set (so when is RecycleTemplate).
Can we understand why IconTintColorBehavior has this issue?
We should be able to keep RecycleTemplate strategy and fix IconTintColorBehavior in order to have best performace.
List component is very important and also its performace are crucial.
thanks a lot!
Android exception
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
[mono-rt] Object name: 'Microsoft.Maui.Graphics.Platform.PlatformGraphicsView'.
[mono-rt] at Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable self) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:line 153
[mono-rt] at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:line 57
[mono-rt] at Android.Views.View.Invalidate() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.Views.View.cs:line 18106
[mono-rt] at Syncfusion.Maui.Graphics.Internals.SfDrawableViewHandler.Invalidate()
[mono-rt] at Syncfusion.Maui.Graphics.Internals.SfDrawableView.InvalidateDrawable()
[mono-rt] at Syncfusion.Maui.Gauges.RadialPointer.InvalidateDrawable()
[mono-rt] at Syncfusion.Maui.Gauges.RadialPointer.OnValueChanged(BindableObject bindable, Object oldValue, Object newValue)
[mono-rt] at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent) in /_/src/Controls/src/Core/BindableObject.cs:line 662
[mono-rt] at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity) in /_/src/Controls/src/Core/BindableObject.cs:line 587
[mono-rt] at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity) in /_/src/Controls/src/Core/BindingExpression.cs:line 163
[mono-rt] at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget) in /_/src/Controls/src/Core/BindingExpression.cs:line 58
[mono-rt] at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.<PropertyChanged>b__50_0() in /_/src/Controls/src/Core/BindingExpression.cs:line 742
[mono-rt] at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass4_0.<DispatchImplementation>b__0() in /_/src/Core/src/Dispatching/Dispatcher.Android.cs:line 24
[mono-rt] at Java.Lang.Thread.RunnableImplementor.Run() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:line 37
[mono-rt] at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Java.Lang.IRunnable.cs:line 84
[mono-rt] at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 22
Hi Luca
Regarding the performance issue:
We have tested the sample you attached on an iOS device, and the performance appears to be fine. Could you please confirm if you are experiencing the performance issue with the attached sample? If so, kindly share a video reference along with the log output details when scrolling the items to check about layout calls details.
Regarding the crash issue:
Could you provide more information about when the crash occurs? Does it happen during load time or while scrolling the ListView? and Please provide us with your ItemTemplate code customization.
Regarding the IconTintColorBehavior:
We are currently investigating the issue on our end. We require two more days to identify the root cause. We will provide further updates on or before September 27, 2024. We appreciate your patience in the meantime.
Hi,
thanks for your message.
Hi Luca,
Regarding iOS Selection:
In ListView, we have internally managed the tap and double-tap gestures for touch interactions, which results in a 0.3-second delay for item selection. We will provide further details regarding this, along with CachingStrategy and IconTintColorBehavior information, on September 27, 2024. We appreciate your patience until then.
Hi Luca,
Regarding the IconTintColorBehavior
We have logged the bug report for the issue "TintColor is not updated properly inside then itemtemplate". We will fix the issue and include the fix in our Upcoming nuget release, which is planned to rolled out on October 22, 2024. We will appreciate your patience until then.
Reg IOS Selection
We have attached a
custom package. Please check the iOS selection performance with this package
and confirm if the issue persists.
Note: Before installing the custom NuGet package, we recommend clearing the NuGet cache to ensure accurate results
How to install the MAUI custom NuGet in the Windows machine?
Hi,
thanks for your response.
Regarding the IconTintColorBehavior: ok I will waiting hoping good news.
Reg IOS Selection: it's better but still slow compared to xamarin version. Attached a video with your custom version. As you can see the effect and color is applied after time and not when i touch has was happing on xamarin forms. Maybe this is the best we can have on MAUI? If you have a different response, please attach a video.
Maybe is because it's in debug and not in release.
Regarding the crash issue on android:
I confirm it happens on android when i filter. I just add a Maui.Gauges as item template in the list.
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
[mono-rt] Object name: 'Microsoft.Maui.Graphics.Platform.PlatformGraphicsView'.
[mono-rt] at Java.Interop.JniPeerMembers.AssertSelf(IJavaPeerable self) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.cs:line 153
[mono-rt] at Java.Interop.JniPeerMembers.JniInstanceMethods.InvokeVirtualVoidMethod(String encodedMember, IJavaPeerable self, JniArgumentValue* parameters) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:line 57
[mono-rt] at Android.Views.View.Invalidate() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Android.Views.View.cs:line 18106
[mono-rt] at Syncfusion.Maui.Graphics.Internals.SfDrawableViewHandler.Invalidate()
[mono-rt] at Syncfusion.Maui.Graphics.Internals.SfDrawableView.InvalidateDrawable()
[mono-rt] at Syncfusion.Maui.Gauges.RadialPointer.InvalidateDrawable()
[mono-rt] at Syncfusion.Maui.Gauges.RadialPointer.OnValueChanged(BindableObject bindable, Object oldValue, Object newValue)
[mono-rt] at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent) in /_/src/Controls/src/Core/BindableObject.cs:line 662
[mono-rt] at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity) in /_/src/Controls/src/Core/BindableObject.cs:line 587
[mono-rt] at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity) in /_/src/Controls/src/Core/BindingExpression.cs:line 163
[mono-rt] at Microsoft.Maui.Controls.BindingExpression.Apply(Boolean fromTarget) in /_/src/Controls/src/Core/BindingExpression.cs:line 58
[mono-rt] at Microsoft.Maui.Controls.BindingExpression.BindingExpressionPart.<PropertyChanged>b__50_0() in /_/src/Controls/src/Core/BindingExpression.cs:line 742
[mono-rt] at Microsoft.Maui.Dispatching.Dispatcher.<>c__DisplayClass4_0.<DispatchImplementation>b__0() in /_/src/Core/src/Dispatching/Dispatcher.Android.cs:line 24
[mono-rt] at Java.Lang.Thread.RunnableImplementor.Run() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:line 37
[mono-rt] at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net8.0/android-34/mcw/Java.Lang.IRunnable.cs:line 84
[mono-rt] at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 22
thanks a lot
Attachment: 20240930_100440_f89cca8e.zip
Luca,
Reg IOS Selection:
We have added support for displaying a ripple effect when tapping on a ListView item in our Volume 3 release (v27.1.48). Could you please disable the ripple animation and confirm the selection performance with both the custom NuGet package and the latest NuGet package? This will greatly help us investigate the issue further.
To disable ripple animation, please refer to the user guide: https://help.syncfusion.com/maui/listview/viewappearance#disable-ripple-effect-on-item-click
Regarding the crash issue on android:
We have checked the sample you attached in the previous update by adding Maui.Gauges in the ItemTemplate, and everything worked as expected without any crashes. Could you please provide your updated ItemTemplate of the ListView? This will help us reproduce the issue and find a solution as soon as possible.
Hi,
thanks for your response.
Reg IOS Selection: adding your code below I have an error, both ios and android, and I'm not able to compile. Maybe I'm doing something wrong. I just copy and paste the this:
xmlns:syncTheme="clr-namespace:Syncfusion.Maui.Themes;assembly=Syncfusion.Maui.Core"<syncTheme:SyncfusionThemeDictionary>
<syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
<ResourceDictionary>
<x:String x:Key="SfListViewTheme">CustomTheme</x:String>
<Color x:Key="SfListViewItemRippleBackground">Transparent</Color>
</ResourceDictionary>
</syncTheme:SyncfusionThemeDictionary.MergedDictionaries>
</syncTheme:SyncfusionThemeDictionary>
Regarding the crash issue on android:
Attached the solution
Hi Luca,
Reg IOS Selection:
When adding a SyncfusionThemeDictionary inside the ContentPage's ResourceDictionary, if there are already other resources present, it must be added to MergeDictionaries. Please ensure that MergeDictionaries are correctly included in your sample.
Please refer the following code snippet:
|
<ContentPage.Resources>
<ResourceDictionary> ------------------------------------------------------- <ResourceDictionary.MergedDictionaries> <syncTheme:SyncfusionThemeDictionary.MergedDictionaries> <ResourceDictionary> <x:String x:Key="SfListViewTheme">CustomTheme</x:String> <Color x:Key="SfListViewItemRippleBackground">Transparent</Color> </ResourceDictionary> </syncTheme:SyncfusionThemeDictionary.MergedDictionaries> </syncTheme:SyncfusionThemeDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary>
</ContentPage.Resources>
|
If you are still encountering the error, please share the error details so we can investigate the issue further.
Reg Android Crash:
We have tested the crash issue by switching tabs in the segment view and did not encounter any crashes. For your reference, we have attached a video of our testing.
Tested device details:
Android 13, API 33 (emulator)
Could you please share the details of the Android device you are using, along with a video of the crash? This will help us accurately reproduce the issue and work towards finding a solution as soon as possible.
Hi,
thanks for your repsonse.
Reg IOS Selection:
I have problems with last version of VS and XCode 16. I need to fix VS and then i'm going to test (always problems)
Reg Android Crash:
please stop testing using emulator, on emulator it's always ok. Test on a real device please.
thanks
Luca,
Regarding iOS Selection:
We will await your feedback after testing on your iOS device.
Regarding Android Crash:
We have tested the issue on the following
Android devices:
When switching between tabs quickly (attempting to open the next tab before the current one is fully loaded), the app closed without any crash reports. It is working fine when switching tab slowly or switch to another tab after current one opened properly. Could you please confirm whether you are facing the crash when switch tabs quickly as we mentioned?
To help us investigate further, please provide the following details:
Regarding iOS Selection:
Debug Mode: no visible improvments.
Release Mode: Bit better now even if on XF was much much better (more fluid).
Regarding Android Crash:
I update to version 27.1.52 and I'm not able to make it happen again.
I track the delay when I swich tab:
Release mode:
From All to 1: 1.5 seconds
From 1 to 2: 1.5 seconds
From 2 to 3: 2,7 seconds
From 3 to All: 3,5 seconds
From All to 3: 2,5 seconds
I'm using Samsung Galaxy A12 Android 13 Octa-core 4 GB di RAM
thanks
Luca
Regarding iOS Issue:
We have tested the issue on an iOS emulator, and the selection is happening without any delay. We have attached a video for your reference. We are currently testing on different devices and will update you with further details on October 22, along with the tint color issue.
Regarding Android Issue:
In your sample, when switching tabs, a new ObservableCollection is created and set to ItemsSource. Changing the ItemsSource at runtime will recreate the ListView items, and the data source will be reallocated, which can cause a delay.
Instead of assigning ItemsSource each time, you can use the existing filtering logic of ListView.
Please refer to the following user guide link:
Filtering in .NET MAUI ListView control | Syncfusion
HI,
thanksd for your response.
Regarding iOS Issue:
On simulator is ok but please try on real device.
Can you please try also adding an effect like the following? (it's not fluid as was on XF when I tap on an Item on IOS)
ListView.SelectionController = new SelectionControllerExt(ItemsListView);
public class SelectionControllerExt : SelectionController
{
SfListView listView;
public SelectionControllerExt(SfListView _listView) : base(_listView)
{
listView = _listView;
}
protected override async void AnimateSelectedItem(ListViewItem selectedListViewItem)
{
base.AnimateSelectedItem(selectedListViewItem);
await Task.WhenAll(
selectedListViewItem.FadeTo(0.3, 150, Easing.SinInOut),
selectedListViewItem.ScaleTo(0.8, 150, Easing.SinInOut)
);
await Task.WhenAll(
selectedListViewItem.FadeTo(1, 150, Easing.SinInOut),
selectedListViewItem.ScaleTo(1, 150, Easing.SinInOut)
);
listView.SelectedItems.Clear();
}
}
Regarding Android Issue:
thanks, i'm going to try.
thanks
Hi Luca,
Regarding iOS issue:
It seems that when an item is selected, the OnSelectTemplate() method is triggered, and the template is returned each time, which may be causing the delay. Unfortunately, we haven't been able to resolve this in our source code. We are currently analyzing ways to improve selection performance at the sample level. We will provide further details by or before October 18, 2024. We appreciate your patience in the meantime.
Regarding Android issue:
Please try the ListView filtering logic and
get back to us. We look forward to hearing from you.
Hi Luca,
We have analyzed the IconTintColorBehavior issue in our source deeply and unable to fix in our side since this issue is related to IconTintColorBehavior. We have prepared the sample and reproduced it at the framework level. We have logged a bug report regarding this issue in the Community Toolkit for .NET MAUI, and I have attached the link to the bug report below for your reference:
In the meantime, we have prepared a workaround to resolve the issue. You can use a BoxView instead of an Image since the image looks like circle shape in given example, and change its BackgroundColor based on your requirements. We have also attached the modified sample for your reference.
I hope this helps! Please let me know if you have any further questions or if there is anything else I can assist you with.
Regards,
Riyas Hameed M
Hi,
thanks for your response.
IconTintColorBehavior issue
The workaround is not good because i'm using image and the circle it's just an example I provided you for testing.
Hope to see the tk on github closed soon.
thanks
Regarding Android issue:
i did what you suggested but I can't see any performance improvements.
Release mode:
From All to 1: 1.2 seconds
From 1 to 2: 1.2 seconds
From 2 to 3: 3 seconds
From 3 to All: 4 seconds
From All to 3: 3 seconds
I added this
private void scFilter_SelectionChanged(object sender, Syncfusion.Maui.Buttons.SelectionChangedEventArgs e)
{
if (listView.DataSource != null)
{
this.listView.DataSource.Filter = FilterItems;
this.listView.DataSource.RefreshFilter();
}
}
private bool FilterItems(object obj)
{
var selectedFilterIndex = scFilter.SelectedIndex;
var module = obj as ListViewSample.Model.Contacts;
if (
(
(selectedFilterIndex < 1 )
|| (selectedFilterIndex == module.Num)
)
)
return true;
else
return false;
}
Luca,
Regarding Android Performance Issue:
As mentioned in the previous update, when using a TemplateSelector, the template is returned each time when switching tabs, which may cause delays.
In your last attached sample, the CachingStrategy is set to CreateNewTemplate, which recreates templates each time you filter. This also results in load time delays, especially when the list contains a large number of items.
We recommend using a single template and managing the visibility of views within that template, rather than using separate templates. Additionally, setting the CachingStrategy to RecycleTemplate will help reduce load time delays when switching tabs. These changes should significantly improve performance.
Note: The Toolkit TintColorBehavior has an issue with updating templates when reusing them. This issue is resolved when using a single template.
Regarding iOS Selection Delay Issue:
It seems the selection performance has improved on iOS. Please review our sample and confirm whether the performance has been improved.
We have attached the modified sample for your reference. Please check it and let us know if you have any further queries.
Hi,
thanks for your response.
Regarding Android issue:
Using just one template and CachingStrategy="RecycleTemplate" works well in the sample app. I think because it's really simple UI
In the real app I have 8 complex templates and even if I creates one master template that contains all others like the following (see the example below), is still better using 8 single templates and CachingStrategy="RecycleTemplate".
At the end the key point is using CachingStrategy="RecycleTemplate", the problem is the bug on image tincolor.
Startup time in release mode on android:
My real app with one template and CachingStrategy="RecycleTemplate" : 33sec
My real app with multiple templates and CachingStrategy="RecycleTemplate" : 12sec
<DataTemplate x:Key="FullTemplate">
<Grid >
<Border IsVisible="{Binding IsTemplate1}">
objects here
</Border>
<Border IsVisible="{Binding IsTemplate2}">
objects here
</Border>
....
<Border IsVisible="{Binding IsTemplate8}">
objects here
</Border>
</Grid>
Luca,
Reg Performance improvement
To enhance performance when using multiple templates, you can return a cached template in the OnTemplate() method.
Please refer the example code snippet:
|
public class CachedDataTemplateSelector : DataTemplateSelector { // Dictionary to store cached templates private readonly Dictionary<Type, DataTemplate> _templateCache = new Dictionary<Type, DataTemplate>();
// Define your DataTemplates public DataTemplate TemplateOne { get; set; } public DataTemplate TemplateTwo { get; set; }
protected override DataTemplate OnSelectTemplate(object item, BindableObject container) { // Get the type of the item for caching purposes var itemType = item.GetType();
// Check if the template is already cached if (_templateCache.TryGetValue(itemType, out var cachedTemplate)) { // Return the cached template if found return cachedTemplate; }
// Otherwise, calculate the template based on item properties (your custom logic here) DataTemplate selectedTemplate; if (item is ItemTypeOne) { selectedTemplate = TemplateOne; } else if (item is ItemTypeTwo) { selectedTemplate = TemplateTwo; } else { // Default template or null if you don't have one selectedTemplate = null; }
// Cache the selected template for future use if (selectedTemplate != null) { _templateCache[itemType] = selectedTemplate; }
// Return the newly selected template return selectedTemplate; } }
|
Caching: Caching the results of the SelectTemplate method in the DataTemplateSelector can help avoid recalculating the template for each item. You can maintain a dictionary to store previously selected templates based on the data type.
Reg tint color issue:
As previously mentioned, the tint color issue is related to the IconTintColorBehavior. We are actively monitoring the situation, and as soon as a solution is provided by the MAUI framework, we will inform you immediately. In the meantime, you can also track this issue via the below link. We appreciate your understanding and patience.