SilverLight Layouts

Ratings:
(4)
Views:899
Banner-Img
  • Share this blog:

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>

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox