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>
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.
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
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…