Busy indicator is not displayed when used in iOS native embedding

I am trying to use SfBusyIndicator in .net native ios application using native embedding.

I have the code like this.

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
        Window = new UIWindow(UIScreen.MainScreen.Bounds);

        MauiAppBuilder builder = MauiApp.CreateBuilder();
        builder.UseMauiEmbedding<Microsoft.Maui.Controls.Application>();
        builder.Services.Add(new Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(UIWindow), Window));
        builder.ConfigureSyncfusionCore();
        MauiApp mauiApp = builder.Build();
        MauiContext = new MauiContext(mauiApp.Services);

var vc = new UIViewController ();


SfBusyIndicator sf = new SfBusyIndicator
{
IsRunning = true,
BackgroundColor = Microsoft.Maui.Graphics.Colors.Green
};

var sfView = sf.ToPlatform(MauiContext);
sfView.Frame = Window!.Frame;
vc.View!.AddSubview(sfView);
Window.RootViewController = vc;
Window.MakeKeyAndVisible ();

return true;
}


when i run the application only the background color is displayed and the indicator is not displayed.

Does SfBusyIndicator work with native embedding?

Thanks




5 Replies

BR Balasubramanian Ramanathan November 14, 2023 09:34 AM UTC

I was able to get it working by wrapping the SfBusyIndicator inside contentpage and contentpage.ToPlatform(mauContext).


When directly use the sfbusyindication.ToPlatform(), the rotating indicator is not centered. It is displayed at the top left.


Would be nice if we could use the SfBusyIndicator without wrapping inside ContentPage.


Is there a way to achieve this with native embedding?





AJ AhamedAliNishad JahirHussain Syncfusion Team November 14, 2023 01:59 PM UTC

Hi Balasubramanian,


We have reviewed your query, and we would like to inform you that you can set the Window frame value to the BusyIndicator frame. Now, the BusyIndicator works fine without wrapping it inside the ContentPage, as demonstrated in the code snippet below. Please review the attached sample and let us know the details.


Code Snippet :

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)

{

        // create a new window instance based on the screen size

        Window = new UIWindow(UIScreen.MainScreen.Bounds);

 

        MauiAppBuilder builder = MauiApp.CreateBuilder();

        builder.UseMauiEmbedding<Microsoft.Maui.Controls.Application>();

        builder.ConfigureSyncfusionCore();

builder.Services.Add(new Microsoft.Extensions.DependencyInjection.ServiceDescriptor(typeof(UIWindow), Window));

 

MauiApp mauiApp = builder.Build();

_mauiContext = new MauiContext(mauiApp.Services);

 

 

        var vc = new UIViewController();

 

 

        SfBusyIndicator sf = new SfBusyIndicator

        {

            IsRunning = true,

            BackgroundColor = Microsoft.Maui.Graphics.Colors.Green,

 

 

        };

 

        sf.Frame = new Rect(Window.Frame.X, Window.Frame.Y, Window.Frame.Width, Window.Frame.Height);

        var sfView = sf.ToPlatform(_mauiContext);

        sfView.Frame = Window!.Frame;

        vc.View!.AddSubview(sfView);

        Window.RootViewController = vc;

        Window.MakeKeyAndVisible();

 

        return true;

 

      

    }



Regards,

Ahamed Ali Nishad.


Attachment: SfBusyiOSNative_f3c696b3.zip


BR Balasubramanian Ramanathan November 15, 2023 12:30 PM UTC

Thanks it is working as expected. It would be nice if could avoid setting the Frame


i mean this line 

        sf.Frame = new Rect(Window.Frame.X, Window.Frame.Y, Window.Frame.Width, Window.Frame.Height);

is not needed. Because i tried with SfCartesianChart and i dont need to set this frame. It would be nice if we could avoid setting this frame with SfBusyIndicator, which makes all of Sf control api consistent and same behaviour.



BV Brundha Velusamy Syncfusion Team November 16, 2023 12:44 PM UTC

Hi Balasubramanian,

 

Thanks for the details.

 

Currently, we are validating the reported issue at our end and we will let you know the details on November 21, 2023. We appreciate your patience until then.

 

Regards,

Brundha V



AJ AhamedAliNishad JahirHussain Syncfusion Team November 21, 2023 01:32 PM UTC

Hi Balasubramanian,

 

We would like to inform you that currently you can use the workaround suggested. We have created a new feature request to "Enhance the behavior of the SfBusyIndicator when utilized within a .NET native iOS application ". Please find the link below to track the status of the feature implementation categorized under improvement.

 

Feedback link: Enhance the behavior of the SfBusyIndicator when utilized within a .NET native iOS application in .NET MAUI | Feedback Portal (syncfusion.com)

 

Please cast your vote to make it count. We will prioritize the features every release based on the demands and we do not have an immediate plan to implement this feature since we have committed to already planned work. So, this feature will be available in any of our upcoming releases.

 

If you have any more specifications/suggestions for the feature request, you can add them as a comment in the portal. We will share the release details in the feedback itself.

 

Regards,

Ahamed Ali Nishad.


Loader.
Up arrow icon