Category: XAML

Creating Button in XAML in WPF and Windows Store App

Below is a sample Xaml code that is used to create a button in WPF and Windows Store App. <Button xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” 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…

What is difference between ‘Name’ and ‘x:Name’ in Xaml ?

When working with a control in Xaml (WPF/Silverlight/Windows Phone /Windows Store App) , you will notice that for a control , there are 2 options to specify the name for the control . One using “Name” property and other using “x:Name” property. What is difference between ‘Name’ and ‘x:Name’ in Xaml ? Both the properties refer to the same item . We generally use x:Name…

Property Elements Example in Xaml for Simple Properties

In Xaml , you can use the property element for simple properties as well . For example , you can set the Height and width of the Button control in Xaml using the property element syntax instead of attributes. Below is the sample code snippet demonstrating this. Property Elements Example in Xaml for Simple Properties

How to add Items to ListBox control in Xaml ?

You can add the Items to a List Box control in Xaml using the Items property . The Items property is an ItemCollection which implements IList. How to add Items to ListBox control in Xaml ? Below is a sample code snippet demonstrating the adding of the Items to ListBox in Xaml of a Windows 10 UWP App. The above showed how to add items…

What is XAML?

What is XAML? XAML is a language from Microsoft which stands for eXtensible Application Markup Language. It is a declarative language used specially for defining application user interfaces. It is XML based. Each XAML tag corresponds to a class in .NET Framework and the properties represent XML attributes. Eg: <Button> </Button> The above tag represents a button that is defined in the System.Windows.Controls.Button

How to Allow only numeric input in a Textbox in WPF ?

If you are looking at ways to accept only digits and decimal points (numeric input) for a textbox in WPF , you could do it by following the below steps. How to Allow only numeric input in a Textbox in WPF ? Add the Event PreviewTextInput for the Textbox in the XAML. In the Xaml.cs , add the following. The regular expression is used so…

Example of Property Elements in Xaml

The Syntax for the property element in Xaml is as follows below TypeName.PropertyName The property elements are always contained inside a typename object and they don’t have the attributes of their own. An example of the property element is the Button.Content property which is used to set the content of the button control which is of type object. The Below code is used to set…

Keywords in XAML Language Namespace

Below are some of the keywords defined in the Xaml Language Namespace Keywords in XAML Language Namespace x:Arrayx:Codex:ConnectionIdx:Argumentsx:Staticx:AsyncRecordsx:Booleanx:Bytex:Charx:Decimalx:Doublex:Int16x:Int32x:Int64x:Singlex:Stringx:TimeSpanx:FactoryMethodx:ClassAttributesx:Classx:ClassModifierx:FieldModifierx:Keyx:Namex:Nullx:Uidx:Urix:Objectx:Propertyx:Referencex:Sharedx:Subclassx:SynchronousModex:Type