Articles in this section
Category / Section

How to use Xamarin.Forms StepProgressBar in Xamarin.Android and Xamarin.iOS platforms?

1 min read

You can convert the SfStepProgressBar from Xamarin Forms into Xamarin Android and Xamarin iOS.

For Android you need to convert the main page in to fragment and replace it in the OnCreate method of MainActivity.cs file

C#

 
public class MainActivity : AppCompatActivity
{
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);
        Forms.Init(this, savedInstanceState);
 
        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.activity_main);
 
        var mainPage = new StepProgressBar().CreateSupportFragment(this);
        SupportFragmentManager
        .BeginTransaction()
        .Replace(Resource.Id.fragment_frame_layout, mainPage)
        .Commit();
    }
}

 

For iOS you need to create the instance for the window and set the main page as rootview in the FinishedLaunching method of AppDelegate.cs file.

 

 
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            Forms.Init();
 
            // create a new window instance based on the screen size
            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            Syncfusion.XForms.iOS.ProgressBar.SfLinearProgressBarRenderer.Init();
            var mainPage = new StepProgressBar().CreateViewController();           
           // If you have defined a root view controller, set it here:
            Window.RootViewController = mainPage;
 
            // make the window visible
            Window.MakeKeyAndVisible();
 
            return true;
        }

 

Click here to download the sample.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied