• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

SilverLight Layouts

SilverLight Layouts are used to arrange controls, the silver light supports three types of layouts

  • Grid
  • Canvas
  • Stack panel

 

Grid Layout

The grid container the Microsoft designed based on HTML table, depending on the requirement we can arrange collection of controls in the multiple rows and in the multiple columns.

Example:- open new silver light application

Go to XAML mode

In the grid tag

 

<Grid X: Name = “layout Root” Background = “white”>

<Grid. Colum Definitions>

<Colum definition width =  “100” > </column Definition>

<column definition width = “100”> </column definition>

<column definition width = “100”> </column definition>

</grid.column definitions>

<grid.Rowdefinitions>

<Row definition Height = “100”> </Row definition>

<Row definition Height = “100”> </Row definition>

<Row definition height = “100”> </Row definition>

</Grid. Row definitions>

<Button X:Name= “b1” Height = “50” width = “50” Grid.Row = “0” Grid. Colum = “1”>

</Button>

<button Grid.Row = “2” Grid. Column = “1” content = “three”>

</button>

</Grid>

 

Canvas Layout

This layout is used to arrange collection of controls by specifying absolute position using left and top properties, this layout same like c# .net form container

EX:- Open new silverlight application

Go to xaml mode

Remove the grid tag and type the following

<canvas>

<Text block x: Name = “t1” Text = “Welcom” Fontsize = “58” canvas.left = “100” canvas.Top = “100”>

</Text block>

<ellipse X:name = “e1” Height = “120” width = “300” stroke = “green” stoke thickness = “10” canvas. Left = “60” canvas.Top = “50”>

</ellipse>

</canvas>

 

Output

Screenshot_4

 

Text Block

This control is used to display read only data, this control like a label control in the previous technologies

  • “X:Name” property used to decide the control name
  • Using “Text” property we can input the data
  • “Font size” property gives font size to the text block control data
  • Using ellipse tag we can create ellipse control
  • Height, weight properties setting control size
  • Stroke property gives border color
  • Fill property gives background color
  • Stroke thickness gives border width

 

Stack Panel

Using stack panel we can create workspace under grid layout and in the canvas layout, we can create workspace in the horizontal or in the vertical order using this container we can arrange collection of controls in the single row or in the single column.

 

Example:- open new silverlight application

Go to XAML mode

In the grid tag

<Grid X: Name = “ layout Root” Background = “white”>
<stack panel orientation = “vertical”>
<button Content = “click” Height = “100” width = “150”>
</button>
<Ellipse Height = “100” width = “150” Fill = “Red”>
</ellipse>
<Rectangle Height = “ 100” width = “150” Fill = “green” stock=”blue”>
</Rectangle>
</stack panel>
</grid>

Summary
Review Date
Reviewed Item
SilverLight Layouts
Author Rating
5

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on SilverLight Layouts"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.