1. Open vs, new project Silverlight.
2. Name Mybannerad, OK.
3. Clear the option "Hosting Silverlight applications in a new Web site", OK.
4. Right-click the project Add folder images. Right-click images Add Existing items, add two pictures gear.png and branded.png.
5. Right-click the MainPage.xaml file and select View Designer. Edit code:
<usercontrol x:class= "Mybannerad.mainpage" xmlns= "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d= "http://schemas.microsoft.com/expression/blend/ 2008 "xmlns:mc=" http://schemas.openxmlformats.org/markup-compatibility/2006 "mc:ignorable=" D "d:designheight=" 700 "D:designwidth=" > <grid x:name= "layoutroot" height= "M" width= "> <rectangle margin=" 66,42,152,20 "stroke=" #FF000000 "radiusx=" 0 "radiusy=" 0 "> <Rectangle.Fill> <lineargradientbrush x:name=" Mrgb "endpoint=" 0.5,1 "startpoint=" 0.5,0 "> <gradientstop color=" #FF000000 "offset=" 0 "/> <gradientstop Color= "#FF5E0805" offset= "0.478"/> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> < Image margin= "48,49,128,20" x:name= "Brandedimage" source= "Images/brand.png"/> <textblock x:Name= "
Titletextblock "margin=" 75,59,161,0 "fontfamily=" Arial "fontsize=" "fontweight=" Bold "textwrapping=" Wrap "Foreground= "#FFF9F4F4" textalignment= "Center" height= "verticalalignment=" "Top" text= "Life without Borders" >
</TextBlock> <textblock x:name= "Footertextblock" margin= "75,564,161,0" fontfamily= "Arial" fontsize= "16" fontweight= "Bold" textwrapping= "Wrap" foreground= "#FFF9F4F4" textalignment= "Center" height= "verticalalignment=" Top "text=" Fabrikam, Inc. > </TextBlock> <image margin= "121,559,216,14" x:name= "Gearimage" source= "Images/gear.png"/> </grid > </UserControl>
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/Silverlight/
6. Your Silverlight application should be like this:
7. Press the F5 test is normal.
8. Create a new document library in the SharePoint site Xaps, find the mybannerad.xap in the Silverlight application you created, and upload it.
9. Create a new Web Part Page in SharePoint Designer, and add Silverlight WebPart. Set properties.
10. Preview in Browser.
Author: csdn Blog Zhang Shihui