In this tutorial, we will see how to capture screenshots on cross platforms using .Net MAUI. The name "Screenshots" indic...

.Net MAUI - Capturing Screenshot .Net MAUI - Capturing Screenshot

A blog about android developement

cap_screenshot

In this tutorial, we will see how to capture screenshots on cross platforms using .Net MAUI. The name "Screenshots" indicates, the image that is the screen of our device allows us to capture the exact situation we want in the application when we use it.


Quick Links:


Project Setup:

  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app

Implementation:

  • To take a screenshot, .NET MAUI provides us with the IScreenshot interface which is exposed by the Screenshot.Default component in the Microsoft.Maui.Media namespace.
  • In Solution Explorer, click MainPage.xaml and replace the page content with what is shown below:
  • Open the MainPage.xaml.cs file and the page content as shown below:
  • IsCaptureSupported: Returns a bool value – Gets a value indicating whether the capturing screenshots are supported.
  • CaptureAsync: Returns an ISscreenshotResult. – It is responsible for taking screenshots of the current application. Therefore, we can get various information about it, such as width and height.
  • Stream: IScreenshotResult also has a Stream property that is used to convert the screenshot to an image object.
  • Assign the derived stream value to the image control as ImageSource.
  • To know more about animations, please visit https://learn.microsoft.com/en-us/dotnet/maui/user-interface/animation/easing

Demo:

Full Code:

Download Code:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.

In this tutorial series, we will see how to use animations in .NET Multi-platform App UI (.NET MAUI), this animation classes targ...

.Net MAUI - Animations .Net MAUI - Animations

A blog about android developement

In this tutorial series, we will see how to use animations in .NET Multi-platform App UI (.NET MAUI), this animation classes target different properties of visual elements, with a typical introductory animation progressively changing a property from one value to another over a period of time.


Quick Links:


Project Setup:

  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app

Implementation:

  • Basic animations can be created with extension methods provided by the ViewExtensions class, in the Microsoft.Maui.Controls namespace, which operate on VisualElement objects.
  • In Solution Explorer, click on MainPage.xaml. Add Title="Main Page" to ContentPage and replace the content of the page to what is shown below:
  • Open MainPage.xaml.cs file and the content of the page to what is shown below:
  • .NET Multi-platform App UI (.NET MAUI) includes an Easing class that enables you to specify a transfer function that controls how animations speed up or slow down as they're running.
  • The animation extension methods in the ViewExtensions class allow an easing function to be specified as the final method argument:
  • To know more about animations, please visit https://learn.microsoft.com/en-us/dotnet/maui/user-interface/animation/easing

Demo:

Full Code:

Download Code:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.

In this tutorial series, we will see how to use NavigationPage, which provides a hierarchical navigation experience to enable you to na...

.Net MAUI - Page Navigation .Net MAUI - Page Navigation

A blog about android developement

In this tutorial series, we will see how to use NavigationPage, which provides a hierarchical navigation experience to enable you to navigate or switch between two or more pages in an app.


Quick Links:


Project Setup:

  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app

Implementation:

  • The navigation in .Net MAUI is similar with Xamarin.Forms Naviagtion
  • In Solution Explorer, click on MainPage.xaml. Add Title="Main Page" to ContentPage and replace the content of the page to what is shown below:
  • In the same way, create a new page as "Next Page" with button to navigate back to previous screen
  • The final output will be like below when we come all the above properties come together.

Full Code:

Download Code:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.

In this tutorial series, we will see how to create a CardView in .Net MAUI using Border control. In .NET Maui provided Microsoft....

.Net MAUI - Card Views using Border Control .Net MAUI - Card Views using Border Control

A blog about android developement

In this tutorial series, we will see how to create a CardView in .Net MAUI using Border control. In .NET Maui provided Microsoft.Maui.Graphics library which provide us a consistent UI drawing API based on native graphics engines, thus making it easier for us to add borders, corners customisations, and shadows for most of the controls and layout contained in .NET MAUI. The new Border Control allows us to add Borders to a single element as a content (can be both a control and a Layout). This brings us a very flexible behavior to control of each corners: top-left, top-right, bottom-left, bottom-right, with our user interface, some of those cases can be adding the border to a button and rounding the upper left and lower right corners.


Quick Links:


Project Setup:

  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app

Implementation:

  • Open the MainPage.xaml file and add the following border control. Border Properties
    Stroke Sets the color that the border will take on.
    StrokeThickness It’s the thickness (width) of the Border.
    StrokeDashOffset It’s the distance within the dash pattern.
    StrokeDashArray Collection of values, which is responsible for specifying the Dash pattern and the spaces used for the border to implement.
    StrokeLineCap Defines the start and end stroke that the border will have. For the stroke shape, it receives the following values: Flat, Round, and Square.
    StrokeMiterLimit Limit on the ration of the miter length to half of the stroke thickness.
  • We also having the StrokeShape property, which allows to modify the shape of the Stroke based on a Shape (the one you want), in addition to this Shape you can modify the edges as you need.
  • We also add shadow property to apply in CardView.
  • The final output will be like below when we come all the above properties come together.

Full Code:

Download Code:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.

In this tutorial series, we will see how to manage the user subscription from the app as we are updating our Subscriptions policy ...

.Net MAUI - Manage Subscription in Android and iOS. .Net MAUI - Manage Subscription in Android and iOS.

A blog about android developement

In this tutorial series, we will see how to manage the user subscription from the app as we are updating our Subscriptions policy to state that users must be able to easily cancel their subscriptions from within the app.

Project Setup:

  • To create .NET MAUI apps, we need the latest Visual Studio 2022 installed with .NET Multi-platform App UI development workload with its default optional installation options in our PC or mac machine.
  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the Configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app

Implementation:

  • open the MainPage.xaml file and add the following button for subscription click
  • For Android, we can open the play store directly to specific app subscription if the sku and the app package name are known and the user is already subscribed. Also, we can open the subscription where all the non-exipry sucscribtions are listed.
  • For iOS, We have specific API to open the app page from the app. But we can open the apple support page "https://support.apple.com/HT202039"
  • This should also adhere to the app store guidelines.

Download Code:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.

In this tutorial series, we will see the basic layout of sign-up screen using the MAUI controls in Visual Studio 2022 on Windows, ...

.Net Multi-Platform App UI - Registration Form .Net Multi-Platform App UI - Registration Form

A blog about android developement

In this tutorial series, we will see the basic layout of sign-up screen using the MAUI controls in Visual Studio 2022 on Windows, or Visual Studio 2022 for Mac 17.4 Preview.

Project Setup:

  • To create .NET MAUI apps, we need the latest Visual Studio 2022 installed with .NET Multi-platform App UI development workload with its default optional installation options in our PC or mac machine.
  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the Configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app

Implementation:

  • open the MainPage.xaml page designer file and add the following entries for email and password like below

Result:

Android

Windows

Download:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.

In this tutorial series, we'll learn how to create and run your first .NET Multi-platform App UI (.NET MAUI) app in Visual Studio ...

.Net Multi-Platform App UI - MAUI Project Setup .Net Multi-Platform App UI - MAUI Project Setup

A blog about android developement

In this tutorial series, we'll learn how to create and run your first .NET Multi-platform App UI (.NET MAUI) app in Visual Studio 2022 on Windows, or Visual Studio 2022 for Mac 17.4 Preview.

Project Setup:

  • To create .NET MAUI apps, we need the latest Visual Studio 2022 installed with .NET Multi-platform App UI development workload with its default optional installation options in our PC or mac machine.
  • Launch Visual Studio 2022, and in the start window click Create a new project to create a new project.
  • In the Create a new project window, select MAUI in the All project types drop-down, select the .NET MAUI App template, and click the Next button:
  • In the Configure your new project window, name your project, choose a suitable location for it, and click the Next button:
  • In the Additional information window, click the Create button:
  • Once the project is created, we can able to see the Android, iOS, Windows and other running options in the toolbar. Press the emulator or run button to build and run the app
  • Visual Studio will build the app, and deploy the app to the emulator or device.
  • The sample app screen will be look like the below in Android, iOS and Windows.

    Android Output:

    iOS Output:

    Windows Output:

Introduction Xamarin.Essentials Xamarin.Essentials provides developers with cross-platform APIs for their mobile applications. Andro...

Xamarin.Forms - Text To Speech Using Xamarin Essentials Xamarin.Forms - Text To Speech Using Xamarin Essentials

A blog about android developement

Introduction

Xamarin.Essentials

Xamarin.Essentials provides developers with cross-platform APIs for their mobile applications. Android, iOS, and UWP offer unique operating system and platform APIs that developers have access to all in C# leveraging Xamarin. Xamarin.Essentials provides a single cross-platform API that works with any Xamarin.Forms, Android, iOS, or UWP application that can be accessed from shared code no matter how the user interface is created.

Text-to-Speech

This enables an application to utilize the built-in text-to-speech engines to speak back text from the device and also to query available languages that the engine can support.


Coding Part

Steps

  1. 1: Creating new Xamarin.Forms Projects
  2. 2: Implementation of Text to Speech in Xamarin Forms

Step 1: Creating new Xamarin.Forms Projects

Create New Project by selecting "New Project" à "Xamarin Cross Platform App" and Clicking "OK". Note: Xamarin.Forms version should be greater than 5.0.

Then Select Android and iOS Platforms as shown below with Code Sharing Strategy as PCL or .Net Standard and Click OK.

Step 2: Implementation of Text to Speech in Xamarin Forms

In this step, we will see how to implement the functionality in Xamarin.Forms.


Platform Specific Changes:

  • If your project's Target Android version is set to Android 11 (R API 30) you must update your Android Manifest with queries that are used with the new package visibility requirements.
  • Open the AndroidManifest.xml file under the Properties folder and add the following inside of the manifest node:

Xamarin Forms App Changes:

  • Add a reference to Xamarin.Essentials in your class:
  • Text-to-Speech works by calling the SpeakAsync method with text and optional parameters, and returns after the utterance has finished.
  • This API provide more options on how the audio is spoken back with SpeechOptions that allows setting the volume, pitch, and locale.

Full Code

Result

Download Code:

You can download the code from GitHub. If you have any doubts, feel free to post a comment. If you liked this article, and it is useful to you, do like, share the article & star the repository on GitHub.