Busy indicator is not visible in windows - Maui

Vaibhav Methuku 60 Reputation points
2024-03-27T09:56:56.5266667+00:00

Hello,

I'm doing the UI operation, I want to display the busy indicator, I had added in the below way.

try
{
    var expander = sender as Expander;
    var headerText = (expander.Header as Border)?.Content is StackLayout headerStackLayout
                    ? (headerStackLayout.Children[0] as Grid)?.Children[0] is StackLayout headerGridStackLayout
                    ? (headerGridStackLayout.Children[0] as Label)?.Text
                    : null
                    : null;

    if (string.IsNullOrEmpty(headerText) || !e.IsExpanded || expander.Content != null)
        return;

    foreach (var item in mExpanders)
    {
        mBindingContextVM.IsBusy = true;
        await Task.Yield();
        var headerLabelText = (item.Value.Header as Border)?.Content is StackLayout headerStack
                              ? (headerStack.Children[0] as Grid)?.Children[0] is StackLayout headerGrid
                              ? (headerGrid.Children[0] as Label)?.Text
                              : null
                              : null;

        if (headerText == headerLabelText)
        {
            var content = AddChildren(item.Key);
            expander.Content = content;
        }
        mBindingContextVM.IsBusy = false;
        await Task.Yield();
    }
}
catch (Exception ex)
{
    mBindingContextVM.IsBusy = false;
    await Task.Yield();
    App.TCOAppDiagnosticsService.ReportException(ex);
}

The above piece of code is working for the android and iOS, unfortunately it is not working with the windows.

FYI - in the AddChildren() function, I'm adding data to the particular expander.

  • I had tried running on main thread as well.

Thanks
Vaibhav Methuku

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,869 questions
{count} votes