Creating a Button in UWP app by specifying the namespace as one of the attributes of button

Published on November 27, 2015 by abundantcode

Filed under Universal Windows App, XAML

Last modified November 27, 2015

Print this page

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

This article have been viewed 5174 times

You can add a button in your Universal Windows Platform (UWP) app by simply adding the Button tag in the Xaml page. You will notice that the Namespace "http://schemas.microsoft.com/winfx/2006/xaml/presentation" is already referred in the Page element.

<Page
    x:Class="ACUWPApp.MainPage"  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" />

You can add a button in the UWP app page by specifying the namespace as one of the attributes of button instead of specifying it at the page level. Below is a sample code snippet demonstrating how to do it.

 <ACNamespace:Button xmlns:ACNamespace="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Content="Click Me" Height="200" Width="200"/>

For readability , it is better to define the commonly used namespace (XML namespace) at the Page level so that this need not be repeated everytime.

Leave a Comment


x

You might be Interested in these Posts

How to delete user account from command line in Windows 10 ?

You can delete a user account from command line in Windows 10 using the net user command and specify...

How to add new user account from command line in Windows 10 ?

You can add a new user account in Windows 10 using command prompt using the net user command and pas...

How to open display settings from command line in Windows 10 ?

The display properties can be found in the settings app in Windows 10 which lets the users to config...