Home › WPF › WPF XAML Hello World
WPF · Apr 2, 2016

WPF XAML Hello World

Here is a simple example to get started with Windows Presentation Foundation (WPF) and Extensible Markup Language (XAML).

First, create a new Visual Studio project and select under Windows templates “WPF Application”:

You should see something like this in Visual Studio:

You will see a default window. Next, let’s add a button to the window. Open Toolbox and drag a Button across. Then, give the button a name:

Double click the button to go to the C# code. Add a line to display a message box:

Press F5 to run the code. Click Submit to see the message box:

 

Stop running. Go back to Visual Studio and note the XAML created:

Note the event on click which links to our C# code:

Clicking space in the attributes of the Button brings up several properties:

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Carl de Souza
KEEP LEARNING. KEEP BUILDING.

Explore AI, agents & Microsoft technology.

I share practical ideas, tutorials, and videos about AI, AI agents, Microsoft technologies, and the Power Platform.