Xamarin / .NET MAUI Simple Todo App - Xamarin-maui Typing CST Test
Loading…
Xamarin / .NET MAUI Simple Todo App — Xamarin-maui Code
Demonstrates a simple Xamarin / .NET MAUI app with a Todo list, adding tasks via UI, and displaying them in a ListView.
// MainPage.xaml.cs
using System.Collections.ObjectModel;
using Microsoft.Maui.Controls;
namespace TodoApp
{
public partial class MainPage : ContentPage
{
ObservableCollection<string> todos = new ObservableCollection<string>();
public MainPage()
{
InitializeComponent();
TodoList.ItemsSource = todos;
}
void AddTodo_Clicked(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(TodoEntry.Text))
{
todos.Add(TodoEntry.Text);
TodoEntry.Text = string.Empty;
}
}
}
}
// MainPage.xaml
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TodoApp.MainPage">
<StackLayout Padding="20">
<Entry x:Name="TodoEntry" Placeholder="New Todo" />
<Button Text="Add" Clicked="AddTodo_Clicked" />
<ListView x:Name="TodoList" />
</StackLayout>
</ContentPage>Xamarin-maui Language Guide
Xamarin.MAUI (Multi-platform App UI) is a cross-platform framework for building native mobile, desktop, and tablet applications using C# and .NET with a single shared codebase.
Primary Use Cases
- ▸Cross-platform mobile applications (iOS, Android)
- ▸Cross-platform desktop applications (Windows, macOS)
- ▸Enterprise business apps with shared codebase
- ▸Apps requiring native device integration
- ▸Rapid prototyping of multi-platform UIs
Notable Features
- ▸Single shared project for all platforms
- ▸Native UI rendering and access to platform APIs
- ▸XAML for declarative UI and MVVM support
- ▸Hot reload for UI and code changes
- ▸Integration with .NET ecosystem and libraries
Origin & Creator
Developed by Microsoft, evolving from Xamarin.Forms, officially released as .NET MAUI in 2022.
Industrial Note
Xamarin.MAUI is ideal for enterprises and developers targeting multiple platforms who want to maximize code sharing while retaining native performance and UI fidelity.