Files
maui-linux/templates/maui-linux-app/MainPage.cs
logikonline d87124fef2 Initial commit: .NET MAUI Linux Platform
Complete Linux platform implementation for .NET MAUI with:

- 35+ Skia-rendered controls (Button, Label, Entry, CarouselView, etc.)
- Platform services (Clipboard, FilePicker, Notifications, DragDrop, etc.)
- Accessibility support (AT-SPI2, High Contrast)
- HiDPI and Input Method support
- 216 unit tests
- CI/CD workflows
- Project templates
- Documentation

🤖 Generated with Claude Code
2025-12-19 09:30:16 +00:00

65 lines
1.6 KiB
C#

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;
namespace MauiLinuxApp;
public class MainPage : ContentPage
{
private int _count = 0;
private readonly Label _counterLabel;
public MainPage()
{
Title = "MauiLinuxApp";
_counterLabel = new Label
{
Text = "Click the button",
HorizontalOptions = LayoutOptions.Center,
FontSize = 18
};
var button = new Button
{
Text = "Click me",
HorizontalOptions = LayoutOptions.Center
};
button.Clicked += OnCounterClicked;
var image = new Image
{
Source = "dotnet_bot.png",
HeightRequest = 200,
HorizontalOptions = LayoutOptions.Center
};
Content = new VerticalStackLayout
{
Spacing = 25,
Padding = new Thickness(30, 0),
VerticalOptions = LayoutOptions.Center,
Children =
{
new Label
{
Text = "Hello, .NET MAUI on Linux!",
FontSize = 32,
HorizontalOptions = LayoutOptions.Center
},
image,
_counterLabel,
button
}
};
}
private void OnCounterClicked(object? sender, EventArgs e)
{
_count++;
_counterLabel.Text = _count == 1 ? "Clicked 1 time" : $"Clicked {_count} times";
}
}