In an exciting development for .NET MAUI, Syncfusion has made significant open-source contributions by releasing 14 essential UI components for free, empowering developers to enhance their applications. These components, found on GitHub and accessible via NuGet, include popular elements like Shimmer and offer capabilities for improved interactivity and visual appeal in .NET MAUI projects. This collaboration underscores Syncfusion’s commitment to the .NET ecosystem and signals a robust future for cross-platform development.
Syncfusion’s contributions align with Microsoft’s broader strategy to expand .NET MAUI’s open-source potential, paving the way for additional community involvement and accelerating the platform’s maturity. A noteworthy part of this collaboration is the ongoing support from Syncfusion for any potential issues and their active involvement in refining the developer experience.
In addition to these components, Microsoft and Syncfusion are working on introducing a new .NET MAUI project template with .NET 9. This template will come preconfigured with Syncfusion’s UI tools, alongside other third-party toolkits, to streamline project setup for developers. This streamlined experience will make it easier for developers to create well-structured, cross-platform applications that perform seamlessly on multiple devices.
Overall, this partnership demonstrates how .NET MAUI is evolving with rich community-driven contributions and shows promising advancements for developers aiming to build sophisticated, cross-platform mobile and desktop applications.
For more details, you can read the original blog post here.
June 24, 2024
Introduction In this tutorial, we will show you how to implement a long press gesture in .NET MAUI using TouchBehavior from the MAUI C...
Detect Long Press in .NET MAUI App using TouchBehavior
In this tutorial, we will show you how to implement a long press gesture in .NET MAUI using TouchBehavior from the MAUI Community Toolkit. Learn how to trigger long press events or commands with parameters and see a live example of updating a button image on a successful long press.
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
Install Plugin
We need to install the "CommunityToolkit.MAUI" by searching in nuget manager and click "Install" to install the plugin
Implementation
Here, we will add the long press behaviour to the image control and you can use as per your need:
Add the below code in the xaml file to have wire-up the event or command between the designer and view model. Add Namespace
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.
Hey! Ever wanted to create cool apps for different devices like phones and
computers? Well, .NET MAUI makes it super easy. It's like a superhero for app
creators! Now, imagine adding fun things like videos to your apps. That's
where the Community Toolkit comes in – a toolbox that lots of developers work
on together. Today, we're exploring the Video Player control, a cool feature
powered by .NET MAUI and its friendly Community Toolkit. Get ready for an
adventure in making your apps more exciting with videos!
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
Install Plugin:
Open Terminal or Command Prompt: Open a terminal or command prompt
window. You can usually find this on your computer by searching for "Command
Prompt" (Windows) or "Terminal" (macOS/Linux).
Navigate to Your Project Folder:
Use the cd command to navigate to your .NET MAUI project folder. For
example:
Install Community Toolkit:
Run the following command to install the CommunityToolkit.Maui package:
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.
Welcome to our newest blog post, where we explore the vibrant realm of MVVM
(Model-View-ViewModel) architecture using the cutting-edge MVVM Toolkit in
.NET MAUI. In this comprehensive guide, we will unravel the intricacies of
MVVM and demonstrate how the MVVM Toolkit in .NET MAUI empowers developers to
create robust, responsive, and easily maintainable cross-platform mobile
applications. Join us on this enlightening journey as we unravel the secrets
of mastering MVVM in the context of .NET MAUI.
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
Install Plugin:
In this steps, we will see the steps to install "MVVM Toolkit" in .NET MAUI
project:
Access NuGet Package Manager: In Visual Studio, right-click on your
.NET MAUI project in the Solution Explorer. From the context menu, select
"Manage NuGet Packages."
Search for "CommunityToolkit.Mvvm": In the NuGet Package Manager,
click on the "Browse" tab. In the search bar, type "CommunityToolkit.Mvvm"
and hit Enter. The package should appear in the search results.
Select and Install the Package: Once you find "CommunityToolkit.Mvvm"
in the search results, click on it to select it. Ensure you choose the
appropriate version compatible with your .NET MAUI project. Click on the
"Install" button to begin the installation process.
Accept License Agreement: During the installation, you may be
prompted to accept the license agreement. Review the terms and conditions
and click on the "Accept" button to proceed.
Wait for Installation to Complete: Visual Studio will download and
install the package along with its dependencies. This process may take a few
moments, depending on your internet connection speed.
Verify Installation: After the installation is complete, verify that
there are no error messages in the Output window. This indicates a
successful installation of the package.
Implementation
View Model
In this step, we create a ViewModel that inherits from the ObservableObject
class. This inheritance is pivotal because ObservableObject implements the
INotifyPropertyChanged interface. By doing so, we gain the ability to
trigger the PropertyChanged event, a vital mechanism enabling the
notification of property value changes to subscribers, primarily the UI.
This synchronization is fundamental for effective data binding, ensuring
seamless coordination between the user interface and the underlying
ViewModel.
For example:
public partial class ItemEntryPageModel : ObservableObject
{
[ObservableProperty]
private int _id;
[ObservableProperty]
private string _name;
[ObservableProperty]
private string _description;
[ICommand]
public async void Save()
{
await Application.Current.MainPage.DisplayAlert("MAUI MVVM Sample", "Item Saved Successfully", "OK");
}
}
When we use the [ObservableProperty] attribute, properties can send
automatic alerts when they change. This is important for connecting data and
updating the user interface (UI) when properties change. When you apply the
[ObservableProperty] attribute to a property, it does a lot of necessary
coding work behind the scenes. It sets up the code needed to tell other
parts of the program when a property changes. This attribute saves time
because you don't have to write all this code manually. For Example:
"_description" & "_name" produces "Description" & "Name"
respectively.
The [ICommand] implementation is a way to connect methods or actions
in the app with what the user sees on the screen. For instance, it can
create a command called SaveCommand that's linked to the Save method. This
linking is crucial for making sure that when a user does something, like
clicking a button, the right action happens in the app.
View
Finally, we will design the View, where we create the user interface using
XAML. Here, we connect the UI elements to the ViewModel properties using
data binding expressions.
This connection enables the View to show and modify task data in real-time,
ensuring a dynamic and responsive user experience.
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.
.NET MAUI, a cross-platform framework, empowers developers to build native
mobile and desktop applications using C# and XAML. It enables the creation of
apps that seamlessly operate on Android, iOS, macOS, and Windows, all from a
unified codebase. This open-source platform is an advancement of Xamarin
Forms, expanding its reach to desktop scenarios while enhancing UI controls
for improved performance and extensibility.
In this article, we will see how we can implement Flyout Page in .NET MAUI project.
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 create a flyout page in a Xamarin.Forms application, you can follow these steps:
Add a new page as AppFlyoutPage (XAML Flyout Page) and add the following code.
namespace MauiFlyoutPage;
public partial class AppFlyoutPage : FlyoutPage
{
public AppFlyoutPage()
{
InitializeComponent();
flyoutPage.btn.Clicked += OpenSecondPageClicked;
}
private void OpenSecondPageClicked(object sender, EventArgs e)
{
if (!((IFlyoutPageController)this).ShouldShowSplitMode)
IsPresented = false;
Detail = new NavigationPage(new SecondPage());
}
}
Here, "flyoutPage.btn" present in the master screen and accessed from the flyout screen using XAML field modifier."
In the same way, created two pages as "FirstPage" and "SecondPage" to navigate between the screens in the flyout menu.
Now, when we running the application, can able see a flyout menu on the left side and the detail content on the right side. Tapping on the button in the flyout master will update the detail content accordingly.
Full Code:
Demo
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.
.NET MAUI, a cross-platform framework, empowers developers to build native
mobile and desktop applications using C# and XAML. It enables the creation of
apps that seamlessly operate on Android, iOS, macOS, and Windows, all from a
unified codebase. This open-source platform is an advancement of Xamarin
Forms, expanding its reach to desktop scenarios while enhancing UI controls
for improved performance and extensibility.
In this article, we will see how we can implement Dynamic Status Bar in .NET MAUI project.
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
Screen Design:
As a first point, we need to implement the screen design as per our
requirement. In this tutorial, we will use 3 buttons like in the following code block.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiStatusBarBehaviour.MainPage">
<ScrollView>
<VerticalStackLayout
Spacing="25"
Padding="30,0"
VerticalOptions="Center">
<Button
Text="Blue"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnBlueClicked"
HorizontalOptions="Center" />
<Button
Text="Green"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnGreenClicked"
HorizontalOptions="Center" />
<Button
Text="Default"
SemanticProperties.Hint="Counts the number of times you click"
Clicked="OnDefaultClicked"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ScrollView>
</ContentPage>
Methods:
To implement this, we can implement in the following methodlogies.
Applying Behaviour in XAML.
Applying Behaviour in Code behind.
Applying without behaviour in Code behind.
In this article, we are going to see "Applying without behaviour in Code behind.".
Just install the .NET MAUI community toolkit to your project.
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.
.NET MAUI, a cross-platform framework, empowers developers to build native
mobile and desktop applications using C# and XAML. It enables the creation of
apps that seamlessly operate on Android, iOS, macOS, and Windows, all from a
unified codebase. This open-source platform is an advancement of Xamarin
Forms, expanding its reach to desktop scenarios while enhancing UI controls
for improved performance and extensibility.
In this article, we will see how we can implement a File Picker in the .NET
MAUI project.
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:
As a first point, we need to implement the screen design as per our
requirement. In this tutorial, we will use 3 controls - button, image, and
label like in the following code block.
FileTypes: The default file types available for selection in the FilePicker are FilePickerFileType.Images, FilePickerFileType.Png, and FilePickerFileType.Videos. However, if you need to specify custom file types for a specific platform, you can create an instance of the FilePickerFileType class. This allows you to define the desired file types according to your requirements.
PickerTitle: The PickOptions.PickerTitle is presented to the user and its behavior varies across different platforms.
Full Code:
Demo
Android:
Windows:
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.
.NET MAUI, a powerful platform for developing cross-platform mobile
applications, provides a seamless way to incorporate Toast functionality into
your app. With the aid of the appropriate tools and resources, implementing an
Toast in .NET MAUI using the .NET MAUI Community Toolkit is a straightforward
process. In this tutorial, we will guide you through the necessary steps to
successfully integrate Toast into your .NET MAUI application.
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:
.NET MAUI Community Toolkit is the key to achieve drawing in our App is to use
Community.ToolKit.Maui NuGet package. It is a collection of reusable elements
such as animations, behaviors converters, among others, for developing
applications for iOS, Android, macOS and WinUI using MAUI.
Now initialize the plugin. Go to your MauiProgram.cs file. In the
CreateMauiApp method, place in the .UseMauiApp<App>() line and
just below it add the following line of code.
CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
await Toast.Make("Hi, How are you?",
ToastDuration.Long,
16)
.Show(cancellationTokenSource.Token);
The methods Make() and Show() are essential for displaying Toast messages on
the screen. Each of these methods possesses specific attributes that
facilitate the configuration of the Toast. Let's delve into a closer
examination of these attributes.
Make:
The Make() method is responsible for creating the Toast and requires the
following parameters:
Text: This is a mandatory parameter represents the message that
will be displayed in the Toast.
Duration: This parameter specifies the exact duration for which the
Toast message will be shown on the screen before fading away. It is an
optional parameter and it's default ToastDuration type is
ToastDuration.Short:
TextSize: This parameter is an optional paramter to set the text
size of the Toast. Default value of this parameter is 14 and it's type is
double.
Show:
This method is responsible for displaying the requested Toast message on the
screen.
Full Code:
Demo
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.
.NET MAUI is a powerful platform for building cross-platform mobile
applications, and with the right tools and resources, it's easy to implement
Avatar View to your app. In this tutorial, we'll walk you
through the steps for adding Avatar View in .NET MAUI using .NET MAUI Community
Toolkit.
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:
.NET MAUI Community Toolkit is the key to achieve drawing in our App is to use
Community.ToolKit.Maui NuGet package. It is a collection of reusable elements
such as animations, behaviors converters, among others, for developing
applications for iOS, Android, macOS and WinUI using MAUI.
Now initialize the plugin. Go to your MauiProgram.cs file. In the
CreateMauiApp method, place in the .UseMauiApp<App>() line and
just below it add the following line of code.
A graphical representation known as an avatar is connected to a particular user in order to identify them. This is frequently utilised in programmes that we use every day, therefore it's crucial that you have access to the tools that will enable you to accomplish it. This tutorial will teach you how to quickly and easily construct the.NET Maui Community Toolkit AvatarView!
Text: This property help to set the text to the view
ImageSource: This property help to set the image to the view
CornerRadius: Determines the shape of the control. The properties can be set in the below ways.
Sample 1: CornerRadius="120"
Sample 2: CornerRadius="120,40,120,40"
Full Code:
Demo
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.
Follow Us
Were this world an endless plain, and by sailing eastward we could for ever reach new distances