by F-Kroll

Xamarin Tips: Convert string to a Page in Xamarin.Forms

You can open your pages dynamically in your Xamarin.Forms application. For that we can use Type.GetType(string):

async Task OpenPage(object obj)
var pageType= Type.GetType($"NamespaceOfYourView.{obj}");
var page = Activator.CreateInstance(pageType) as Page;
await Application.Current.MainPage.Navigation.PushAsync(page );

You can read details of Type.GetType in here.




Software Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

[JS] An algorithm a day: Caesar cipher

Event Delegation & Front-End Optimization, and a super simple example.

Setting Up Webpack for React, ES6, and Babel for Development

10 Tips for Our Coding Bootcamp’s Technical Interview

Quick Sort Implementation in JavaSript

Quick Sort in JS

expo-app-loading ( SPLASH ERROR)

What Programmers Don’t Tell You About Being a Programmer

Memory Management in JavaScript

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tuğçe Arar

Tuğçe Arar

Software Engineer

More from Medium

Learn Full Stack Development Hacks Ever

Blog Post 1 — An Introduction to Developing Web Apps using ASP.NET Core

Visual Studio 2022 Browser Edge with Your Profile

C# How to make WPF TextBox accept only numeric inputs?