Silverlight has many User Interface (UI) controls. .NET programmers already familiar with ASP.Net or (especially) WPF will find using the Silverlight controls very natural and straight forward.
Silver light Controls (split in two to make it easier to view)
Functionality right out of the box. Moreover, all of the standard controls can be modified in
numerous ways to meet your needs.
The look and feel of the control can be tweaked through styles or can be entirely redesigned
through templates, and the behavior of the controls can be modified through event handlers. In
the rare cases when none of that is enough, you can create (or derive) your own customized
controls as well.
Creating the First Example - A Grid with Controls
Open Visual Studio 2008 and click on Create Project and then in the new project window you'll want to create a C# project using the Silverlight Application Template.
Pick a location for your application and give it a meaningful name; be sure that you are building
against the latest framework.
Creating a New Silverlight Project
When you click OK you will next be asked if you'd like to generate a Web Site or a Web
Application (using the top radio button) or just a test page (using the bottom radio button) or if
you'd like to link to an existing web site; all as shown in the next figure.
Choose Simple HTML Test Page
Visual Studio create a simple application foryou. If Page.xaml doesn't open utomatically, double click on it in the Solution Explorer. You should find that Visual Studio has guessed that you want a grid as your main container, and has created one for you and named it LayoutRoot. (Also note that the very first declaration in each "page" is a UserControl.
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
In fact a Page is a UserControl, and we'll return to that relationship in a later tutorial.
The Grid definition created by Visual Studio 2008 looks like this:
Defining Rows and Properties
You define the Rows for a table inside the Grid.RowDefinitions element. For each Row, you add
a RowDefinition element, which itself may have various properties, including a specific height,
or if you prefer you may set the height to be proportional to the available space or to take all the
space not taken by other rows.
Height="Auto"With Auto, the Grid’s space is distributed evenly based on the size of the content within the row.
Star or Proportional Sizing
In proportional sizing the value of a column or row is expressed in Xaml as *.
ration by using 5* and 7*).
Silverlight XAML Controls
Wednesday, July 22, 2009
Posted by Usama Wahab Khan at 3:21 AM
Labels: Silverlight
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment