Duplicated
Last Updated: 15 May 2024 08:13 by ANANDHA
ANANDHA
Created on: 14 May 2024 09:55
Category: UI for .NET MAUI
Type: Bug Report
0
RadListView.GetDataView now always returns null in MAUI

I recently migrated my code from Xamarin.forms to MAUI.
RadListView.GetDataView now always returns null in MAUI , its working fine in Xamarin.forms. 

I am trying to  close all the groups while loading, but facing a null exception with DATAVIEW

protected override void OnAppearing()
{
        base.OnAppearing();
        try
        {
 //collapse all
 var dataView = MyRadListView.GetDataView();
 dataView.CollapseAll();}}    

Duplicated
This item is a duplicate of an already existing item. You can find the original item here:
2 comments
ANANDHA
Posted on: 15 May 2024 08:13

@Didi

Thanks first. 

It works if I put in "Page_Loaded".

Regards,

Anandha Bhamini

 

 

ADMIN
Didi
Posted on: 15 May 2024 07:50

Hello ANANDHA,

I see you add the collapse all code inside the OnAppearing. This is too early, the control is not loaded on the page. MAUI and Xamarin are different frameworks. 

I can suggest you add the collapse all code inside the page loaded event. So to be sure that the page is loaded, then execute logic to the elements inside the page. 

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();

        this.page.Loaded += Page_Loaded;
    }

    private void Page_Loaded(object? sender, EventArgs e)
    {
        Dispatcher.StartTimer(TimeSpan.FromMicroseconds(200), () => {
            var data = this.listView.GetDataView();
            if (data != null)
            {
                data.CollapseAll();
            }

            return false;
        });
    }
}

 

Regards,
Didi
Progress Telerik

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com