
Код: Выделить всё
using System.Collections.Generic;
using Microsoft.Maui.Controls;
namespace SideManagementTool
{
public class MenuItem
{
public string Icon { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}
public partial class MainPage : ContentPage
{
public List MenuItems { get; set; }
public MainPage()
{
InitializeComponent();
// Define the menu items using local images
MenuItems = new List
{
new MenuItem { Icon = "icon_dashboard.png", Title = "Dashboard", Description = "Overview of activities" },
new MenuItem { Icon = "icon_projects.png", Title = "Projects", Description = "Manage your projects" },
new MenuItem { Icon = "icon_notifications.png", Title = "Notifications", Description = "Check notifications" },
new MenuItem { Icon = "icon_analytics.png", Title = "Analytics", Description = "View analytics data" },
new MenuItem { Icon = "icon_items.png", Title = "Items", Description = "Manage items" },
new MenuItem { Icon = "icon_settings.png", Title = "Settings", Description = "Configure settings" }
};
// Set the BindingContext to self so that the XAML can access the properties
BindingContext = this;
}
// Command for handling item click
public Command OnMenuItemClicked => new Command((item) =>
{
DisplayAlert("Menu Clicked", $"You clicked on {item.Title}", "OK");
});
}
}
Код: Выделить всё
Возможно, кто-то из вас сможет помогите мне дальше.
Подробнее здесь: https://stackoverflow.com/questions/791 ... -correctly