WPF XAML Hello World

Leave a comment

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:

 

 

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.
 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET'S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

 

ABOUT CARL DE SOUZA

Carl de Souza is a developer and architect focusing on Microsoft Dynamics 365, Power BI, Azure, and AI.

carldesouza.comLinkedIn Twitter | YouTube

 

See more articles on: WPF

Leave a Reply

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