In properties folder we find two files
- App Manifest.xml
- Assembly info.cs
App Manifest.xml
This is the application manifest file that is required to generate the application package we should not edit this file strictly prohibited
Assembly Info.cs
This file contains the name and version metadata that is embedded into the generated assembly
.xap file:-
This is silver light application package file. This file will be generated when we built the project. This is a compressed zip file which contains all the necessary files that are required to start the application
The references in silver light applications are
- Ms corlib’dll
- dll
- corc.dll
- Net.dll
- windows.dll
- windows.Browser.dll
- xml.dll
Main Page files
These are the main files of silver light application that is
Page.xaml
Page.xaml.cs
Page.xaml wil contain designing of the page
Page.xaml. cs will contain code behind code in c# this page class is inherited from user control class
Application or app files
we find two app files with the name
App. Xaml
App.xaml.cs
This App class files are required by the silver light application to display application user interface
This App class is instantiated by the silver light plug in after the .xap file is created
Silver light application project website files
- js
This is a java script helper files that contains functions to initialize silver light plug in instances and functions for determining the clients installed version of the plug in.
- .Html file
html file is used to configure and instantiate the silver light plug in which downloads and runs the silver light application.
In general name of this file is concatenation of the name of the silver light application and test page.html that is if silver light application name is “A” then html file name is A Test page. Html
If silver light application name is “B” then silver light application name is best page .html
- .Aspx file
This file is the default startup webpage the name of this file is concatenation of sidelight application name and Testpage.sapx
Eg attest page. Xspx
- config files
It is used to perform configuration settings of the webpage
Silver light controls
1) border 8) Ellipse 15) pass word box
2) button 9) Grid 16) progress box
3) calendar 10) Grid splitter 17) Radio Button
4) Canvas 11) Image 18) Rectangle
5) check Box 12) list box 20) Scroll Bar
6) Content control 13) Medical element 21) Scroll viewer
22) slider
Controls added in 3.0 & 4.0 versions
27) Auto complete box 39) popup
28) child window 40) Repeat button
29) Data pager 41) Rich text Box
31) description viewer 42) Save file dialog
32) frame 43) Tool Tip
33) Headered Items control 44) Tree view
34) Hyper link Button 45) validation summary
35) link presenter 46) View box
36) label 47) visualizing stickiness
37) open file dialog 48) web browser
38) page
Text box:-
Silver Light Properties
Back ground
Border Brush
Data context
Font family
Font size
Is Enable
Margin
Max Height
max Length
Font style
- Normal (default)
- italic
Font weight
- Normal [Default]
- Black — extra height
- Bold — Light
- Extra Bold
min height
min width
Foreground
Height
opacity
opacity mask
Horizontal alignment
- alignment
- center
- Right
- Stretch
Render transform
Render Transform origin
selection back Ground
Horizontal content alignment
- Stretch
- left
- Right
- Center
Selection fore Ground
Text
Text Alignment
- left [default]
- Center
- Right
Text wrapping
- Wrap
- Now wrap (defaults)
Visibility visible [Default) collapsed
Width
Vertical alignment
- Top (default)
- bottom
- center
- stretch
Vertical content alignment
- Top (default)
- bottom
- center
- stretch
Horizontal scrollbar visibility
- Disabled
- Auto
- visible
- Hidden (default)
Sit any control we create in silver light has as special class and all these controls and all these controls are available in system windows controls name space
Example to create a control at runtime
Go to page.xamlfile and write the following code in page_loaded event or in Layout root_loaded event
Private did layout Root_loaded (object sender, routed even ttrgs e)
{
Button BI = new Button()
BI.content = “Submit”;
BI.width=100;
BI.Height=40;
This layout root _chil(dren:add(d);
Run the application & check
Adding an event to the control At Runtime
For the above example additionally add the following code
Private void layout root_loadedc
{
Button BI = ne
This.layout root_children _add(B)
BI.Click +=new routed event handler (f).
}
Private void fill object sender, routed event arg
{
Textboxl.text.”Sathya”;
}
}