Neues .NET MAUI -App -Projekt wirft "den Namen" InitializeComponent "aus, die im aktuellen Kontext nicht vorhanden sind.
Posted: 13 Feb 2025, 03:38
Ich habe versucht, mit .NET MAUI zu spielen und meine Entwicklungsumgebung eingerichtet, die in den Schritten folgen, wie in:
app.xaml:
- https: // lern.microsoft.com/en-us/dotnet/maui/get-started/first-app?pivots=windows
- https://learn.microsoft.com/en-us/s/ Windows/Apps/Project-Reunion/Setup-your-Development-Environment#forders-Workload--and-components
- https://learn.microsoft.com/en-us/ Xamarin/Android/Get-Started/Installation/Android-Emulator/Geräte-Manager? Tabs = Windows & Pivots = Windows
app.xaml:
Code: Select all
...
< /code>
app.xaml.cs
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;
using System;
using Application = Microsoft.Maui.Controls.Application;
namespace MauiApp1
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage.xaml:
ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp1.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">
...
< /code>
MainPage.xaml.cs
using System;
using Microsoft.Maui.Controls;
namespace MauiApp1
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();