Creating Button in XAML in WPF and Windows Store App

Published on July 24, 2015 by Senthil Kumar

Filed under XAML

Last modified July 24, 2015

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 2.6 (5 votes)

This article have been viewed 17689 times

Below is a sample Xaml code that is used to create a button in WPF and Windows Store App.

<Button xmlns="" Content="Abundantcode Button"/>

The Button can also be created in the code behind of your Xaml page in C# . You would generally see the difference in the namespace based on the UI framework.

For example , if you want to create a button in C# in your WPF application , you would use the System.Windows.Controls namespace as shown below.

System.Windows.Controls.Button btn1 = new System.Windows.Controls.Button();
btn1.Content = "Abundantcode Button";

If you are using the Windows Store or Windows Phone App , you can use the button class that is defined in the namespace Windows.UI.Xaml.Controls.

Windows.UI.Xaml.Controls.Button btn1 = new Windows.UI.Xaml.Controls.Button();
btn1.Content = "Abundantcode Button";

Leave a Comment


You might be Interested in these Posts

Can you run a Windows 10 Universal Apps on Windows 8.1 ?

This is one of the frequently asked question by most of the developers who are new to Windows 10 App...

How to get the Computer Name in C# ?

When working on a Winforms or Console application using C# , sometimes you might need to get the com...

How to Turnoff Frame rate counter in UWP App ?

You can turn off the frame rate counter in your Universal Windows Platform (UAP) apps by following t...