SFListVIew Change span count based on screen size

Hi,

I'm following your doc here https://help.syncfusion.com/maui/listview/layouts#change-span-count-based-on-screen-size

but Application.Current.MainPage.Width return -1


do you know why?

thans


3 Replies

KK Kamala Kannan Sakthivel Syncfusion Team June 18, 2024 01:07 PM UTC

Hi Luca,
We have checked the reported scenario at our end from the given UG link. When setting thee AppShell page as MainPage , the Application.Current.MainPage.Width getting  NaN value. To resolve the scenario, please use anyone of the below workarounds,
 



Or

Simply by setting the MainPage directly in App.xaml.cs. As mentioned below
 


If you still facing any issue,
Please let us know if you have any concern.


Regards,

Kamala Kannan S



LU Luca June 18, 2024 01:40 PM UTC

thanks it's working!

I'm using protected override void OnSizeAllocated, is it ok or is better your property changed event



KK Kamala Kannan Sakthivel Syncfusion Team June 19, 2024 12:47 PM UTC

Hi Luca,

Yes, you can use OnSizeAllocated instead of PropertyChanged, as OnSizeAllocated is called whenever a size change occurs.

Please let us know if you have any concern.


Loader.
Up arrow icon