Files
maui-linux/templates/openmaui-linux-app/MainPage.cs
logikonline 071df4eb28 Rename package to OpenMaui.Controls.Linux
- Changed package ID from Microsoft.Maui.Controls.Linux to OpenMaui.Controls.Linux
- Updated all project files, namespaces, and documentation
- Renamed template from maui-linux to openmaui-linux
- Updated NuGet badges and install commands
- Maintained MarketAlly LLC as owner/author

Package: OpenMaui.Controls.Linux
Template: OpenMaui.Linux.Templates
Install: dotnet add package OpenMaui.Controls.Linux --prerelease
2025-12-19 05:01:34 -05: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 OpenMauiLinuxApp;
public class MainPage : ContentPage
{
private int _count = 0;
private readonly Label _counterLabel;
public MainPage()
{
Title = "OpenMauiLinuxApp";
_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";
}
}