Tag: 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…
Rectangle and MatrixTransform example in Silverlight and XAML
Below is a sample code snippet demonstrating how to use the MatrixTransform with the Rectangle control in Silverlight and XAML. Rectangle and MatrixTransform example in Silverlight and XAML <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Width=”400″ Height=”300″ > <Canvas.Background> <SolidColorBrush Color=”Yellow”/> </Canvas.Background> <Rectangle Width=”190″ Height=”160″ Fill=”Red” Stroke=”Green” Canvas.Left=”0″ Canvas.Top=”50″ RenderTransformOrigin=”0,0″ > <Rectangle.RenderTransform> <MatrixTransform> <MatrixTransform.Matrix> <Matrix M11=”0.5″ M12=”0.5″ OffsetX=”1 ” M21=”0″ M22=”1″ OffsetY=”0″ /> </MatrixTransform.Matrix> </MatrixTransform> </Rectangle.RenderTransform> </Rectangle> </Canvas>
What are Markup Extensions in XAML?
If you are working on XAML specially when developing the UI in Windows Phone 8 or Windows 8 App, you would have come across this term. What are Markup Extensions in XAML? Markup extensions are the expressions that is surrounded by the curly brackets in XAML. The mark-up extensions are generally used to bind the data or for the resources An example of the Markup…
Rectangle and ScaleTransform example in Silverlight and XAML
Below is a sample code snippet demonstrating how to use the ScaleTransform with the Rectangle control in Silverlight and XAML. Rectangle and ScaleTransform example in Silverlight and XAML <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Width=”400″ Height=”300″ > <Canvas.Background> <SolidColorBrush Color=”Yellow”/> </Canvas.Background> <Rectangle Width=”190″ Height=”160″ Fill=”Red” Stroke=”Green” Canvas.Left=”200″ Canvas.Top=”50″ RenderTransformOrigin=”0,0″ > <Rectangle.RenderTransform> <ScaleTransform ScaleX=”2″ ScaleY=”2″/> </Rectangle.RenderTransform> </Rectangle> </Canvas>
Rectangle and RotateTransform example in Silverlight and XAML
Below is a sample code snippet demonstrating how to use the RotateTransform with the Recangle control in Silverlight and XAML. Rectangle and RotateTransform example in Silverlight and XAML <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Width=”400″ Height=”300″ > <Canvas.Background> <SolidColorBrush Color=”Yellow”/> </Canvas.Background> <Rectangle Width=”190″ Height=”160″ Fill=”Red” Stroke=”Green” Canvas.Left=”200″ Canvas.Top=”50″ RenderTransformOrigin=”0,0″ > <Rectangle.RenderTransform> <RotateTransform Angle=”45″/> </Rectangle.RenderTransform> </Rectangle> </Canvas>
File Templates for developing Windows 8 App using XAML
The Windows 8 SDK provides the developers to choose from several types of file templates for creating the Windows 8 Modern UI App. These file templates include Basic Page Split Page Items Page Item Detail Page Grouped Items Page Group Detail Page Resource Dictionary Templated Control User Control File Open Picker Contract Search Contract Search Target Contract
Rectangle and TranslateTransform example in Silverlight and XAML
Below is a sample code snippet demonstrating how to use the TranslateTransform with the Rectangle control in Silverlight and XAML. Rectangle and TranslateTransform example in Silverlight and XAML <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Width=”400″ Height=”300″ > <Canvas.Background> <SolidColorBrush Color=”Yellow”/> </Canvas.Background> <Rectangle Width=”190″ Height=”160″ Fill=”Red” Stroke=”Green” Canvas.Left=”200″ Canvas.Top=”50″ RenderTransformOrigin=”0,0″ > <Rectangle.RenderTransform> <TranslateTransform X=”100″ Y=”100″/> </Rectangle.RenderTransform> </Rectangle> </Canvas>
Default Value of Row and Column attached properties in XAML
In the Windows Phone XAML page , when you place a control inside the grid column or row , you would have noticed that the sometimes the row and column value are not specified . This means that the row and column attached properties of the grid defaults to the value zero and hence its not mandatory to specify Grid.Column or Grid.Row to 0 when…
Creating a Canvas Control with Children in Silverlight using XAML
Below is a sample code snippet for creating a Canvas Control with Children in Silverlight 5 using XAML. Canvas Control with Children in Silverlight 5 using XAML <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Background=”Green” Width=”400″ Height=”300″ > <Ellipse x:Name=”ACEllipse” Fill=”Red” Stroke=”Pink” Width=”200″ Height=”200″/> </Canvas>
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 the below steps. How to Turnoff Frame rate counter in UWP App ? 1. Open your UWP project built using C# and XAML in Visual Studio. 2. From Visual Studio Solution explorer , open App.xaml.cs. 3. Set the DebugSettings.EnableFrameRateCounter property with the false false. as shown below.
mc:Ignorable attribute in Windows Phone XAML Page
When a new Windows Phone Project is created, it creates the MainPage.xaml by default. This page contains the attribute mc:Ignorable=”d” This is an attribute which indicates to the compiler to ignore any other attributes that starts with “d”. For example, the attributes d: DesignHeight or d: DesignWidth is a typical example of the compiler ignoring the height and width attributes. These attributes are only used…
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
Creating a Simple XAML for Windows Phone 8 App
In this article, let’s have a look at how to create our first Windows Phone 8 App using the XAML for Windows Phone App template in Visual Studio 2012. Creating a Simple XAML for Windows Phone 8 App To create a XAML for Windows Phone App, follow the below step by step instructions. 1. Launch Visual Studio 2012. 2. Click File -> New -> Project….
Rectangle and SkewTransform example in Silverlight and XAML
Below is a sample code snippet demonstrating how to use the SkewTransform with the Rectangle control in Silverlight and XAML. Rectangle and SkewTransform example in Silverlight and XAML <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Width=”400″ Height=”300″ > <Canvas.Background> <SolidColorBrush Color=”Yellow”/> </Canvas.Background> <Rectangle Width=”190″ Height=”160″ Fill=”Red” Stroke=”Green” Canvas.Left=”0″ Canvas.Top=”50″ RenderTransformOrigin=”0,0″ > <Rectangle.RenderTransform> <SkewTransform AngleX=”45″ /> </Rectangle.RenderTransform> </Rectangle> </Canvas>
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…
Creating an Animation in XAML and Silverlight
Below is a sample code snippet that demonstrates how to create a simple animation in XAML and Silverlight Creating an Animation in XAML and Silverlight <Grid x:Name=”LayoutRoot” Background=”White”> <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Width=”400″ Height=”300″ > <Canvas.Background> <SolidColorBrush Color=”Yellow”/> </Canvas.Background> <Rectangle Width=”190″ Height=”160″ Fill=”Red” Stroke=”Green” Canvas.Left=”0″ Canvas.Top=”50″ RenderTransformOrigin=”0,0″ > <Rectangle.RenderTransform> <TransformGroup> <RotateTransform x:Name=”RotateTransform” Angle=”0″/> <ScaleTransform x:Name=”ScaleTransform” ScaleX=”0″ ScaleY=”0″ /> </TransformGroup> </Rectangle.RenderTransform> </Rectangle> </Canvas> <Grid.Triggers> <EventTrigger RoutedEvent=”Grid.Loaded”>…
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
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. 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….
Creating a Simple Canvas in Silverlight using XAML
Below is a sample code snippet for creating a canvas control in Silverlight 5 using XAML. Creating a Simple Canvas in Silverlight using XAML <Canvas x:Name=”ACCanvas” xmlns=”http://schemas.microsoft.com/client/2007″ xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” Background=”Green” Width=”400″ Height=”300″ > </Canvas>
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…