📅  最后修改于: 2023-12-03 14:48:34.942000             🧑  作者: Mango
Windows Presentation Foundation (WPF) is a graphical subsystem for building Windows desktop applications. It provides a unified programming model for creating interactive and visually stunning user interfaces. In this guide, we will walk you through the process of creating a "Hello World" application using WPF.
MainWindow.xaml
file.<Window x:Class="WpfHelloWorld.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Hello World" Height="350" Width="525">
<Grid>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24">
Hello World!
</TextBlock>
</Grid>
</Window>
MainWindow.xaml.cs
file.using System.Windows;
namespace WpfHelloWorld
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
F5
or click on the "Start Debugging" button to run the application.Congratulations! You have successfully created a "Hello World" application using WPF.
WPF is a powerful framework for building Windows desktop applications with rich user interfaces. This guide provided you with a basic introduction to creating a simple WPF application. Explore further to unleash the full potential of WPF and build more complex and feature-rich applications.