Category: XAML

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

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…

Keywords in XAML Language Namespace

Below are some of the keywords defined in the Xaml Language Namespace Keywords in XAML Language Namespace x:Array x:Code x:ConnectionId x:Arguments x:Static x:AsyncRecords x:Boolean x:Byte x:Char x:Decimal x:Double x:Int16 x:Int32 x:Int64 x:Single x:String x:TimeSpan x:FactoryMethod x:ClassAttributes x:Class x:ClassModifier x:FieldModifier x:Key x:Name x:Null x:Uid x:Uri x:Object x:Property x:Reference x:Shared x:Subclass x:SynchronousMode x:Type Tutorials you might find interesting:Senthil-Kumar-B-Posted-by-Senthil-Kumar-B-August-12-2020-CSharp-3-Min-Read-Microsoft-had-released-the-preview-version-of-.NET-5-some-time-back-which-comes-with-C-9-Preview-too.-While-it-is-sti…3 New C# 8 Features We Are Excited AboutC Program…

How to add entries to ResourceDirectory in Windows 10 UWP Apps using C# ?

Below is a sample code snippet demonstrating how the entries can be added to the ResourceDirectory in Windows 10 UWP application using C#. How to add entries to ResourceDirectory in Windows 10 UWP Apps using C# ? ResourceDictionary resourceDir = new ResourceDictionary(); Windows.UI.Color redColor = Windows.UI.Colors.Red; Windows.UI.Color blueColor = Windows.UI.Colors.Blue; resourceDir.Add(“item1”, redColor); resourceDir.Add(“item2”, blueColor); Tutorials you might find interesting:[email protected]secabcrSenthil-Kumar-B-Posted-by-Senthil-Kumar-B-August-12-2020-CSharp-3-Min-Read-Microsoft-had-released-the-preview-version-of-.NET-5-some-time-back-which-comes-with-C-9-Preview-too.-While-it-is-sti…Quick Tip —CSS Containment Module by @[email protected]_vault

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. <ListBox xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”> <ListBox.Items> <ListBoxItem Content=”Abundantcode 1″/> <ListBoxItem…

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 <Button> <Button.Content> Click Abundantcode </Button.Content> <Button.Width> 200 </Button.Width> <Button.Height> 200…

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. <Button> <Button.Content> Click Abundantcode </Button.Content> </Button> The…

How to embed Rectangle inside a Button in Windows Store App using C#?

Below is a sample code demonstrating how to embed a Rectangle inside a Button in Windows Store App using C#?. How to embed Rectangle inside a Button in Windows Store App using C#? Windows.UI.Xaml.Controls.Button ACBtn = new Windows.UI.Xaml.Controls.Button { Width=200 , Height = 100 }; Windows.UI.Xaml.Shapes.Rectangle rectangle1 = new Windows.UI.Xaml.Shapes.Rectangle() { Width = 175, Height = 75, Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.AliceBlue) }; ACBtn.Content = rectangle1;…

How to embed Rectangle inside a Button in Xaml ?

Below is a sample code demonstrating how to embed a rectangle inside a Button in Xaml . How to embed Rectangle inside a Button in Xaml ? <Button Width=”100″ Height=”200″> <Rectangle Width=”70″ Height=”100″ Fill=”AliceBlue”></Rectangle> </Button> Tutorials you might find interesting:Quick Tip —CSS Containment Module by @[email protected]_vaultSenthil-Kumar-B-Posted-by-Senthil-Kumar-B-August-12-2020-CSharp-3-Min-Read-Microsoft-had-released-the-preview-version-of-.NET-5-some-time-back-which-comes-with-C-9-Preview-too.-While-it-is-sti…

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…

How to Pass enum as command parameter in Xaml ?

Below is a sample code snippet demonstrating how to pass enum as command parameter in Xaml. How to Pass enum as command parameter in Xaml ? <Button CommandParameter=”{x:Static local:EmployeeType.ContractEmployee}” /> Tutorials you might find interesting:Azure Q&A – Part 1Quick Tip —CSS Containment Module by @[email protected]_vaultSenthil-Kumar-B-Posted-by-Senthil-Kumar-B-August-12-2020-CSharp-3-Min-Read-Microsoft-had-released-the-preview-version-of-.NET-5-some-time-back-which-comes-with-C-9-Preview-too.-While-it-is-sti…