Table Of ContentFox ffirs.tex V3-01/30/2009 5:09pm Pageii
Fox ffirs.tex V3-01/30/2009 5:09pm Pagei
Professional Microsoft® SharePoint® 2007
™
Development Using Silverlight 2
Introduction ..............................................................xiii
Chapter1:IntroductiontoSilverlight ....................................... 1
Chapter2:YourFirstSilverlightandSharePointIntegration ................ 23
Chapter3:CreatingCustomFieldTypes ................................... 57
Chapter4:BrandingyourSharePointsite .................................111
Chapter5:CustomWebParts ............................................145
Chapter6:AdvancedCustomWebParts..................................169
Chapter7:DataConnectivity.............................................205
Chapter8:BringingItAllTogether........................................247
Index ....................................................................285
Fox ffirs.tex V3-01/30/2009 5:09pm Pageiii
Professional
Microsoft® SharePoint® 2007 Development
Using Silverlight™ 2
Steve Fox
Paul Stubbs
WileyPublishing,Inc.
Fox ffirs.tex V3-01/30/2009 5:09pm Pageiv
Professional Microsoft® SharePoint® 2007 Development
™
Using Silverlight 2
Publishedby
WileyPublishing,Inc.
10475CrosspointBoulevard
Indianapolis,IN46256
www.wiley.com
Copyright© 2009byWileyPublishing,Inc.,Indianapolis,Indiana
PublishedsimultaneouslyinCanada
ISBN:978-0-470-43400-0
ManufacturedintheUnitedStatesofAmerica
10987654321
LibraryofCongressCataloging-in-PublicationData
Fox,Steven,1970-
ProfessionalMicrosoftSharePoint2007developmentusingSilverlight2/SteveFox,PaulStubbs.
p.cm.
Includesindex.
ISBN978-0-470-43400-0(paper/website)
1. MicrosoftSharePoint(Electronicresource)2. Silverlight(Electronicresource)
3. Intranets(Computernetworks)I.Stubbs,PaulR.,1969-II.Title.
TK5105.875.I6F6932009
006.7’882—dc22
2008054925
Nopartofthispublicationmaybereproduced,storedinaretrievalsystemortransmittedinanyformorbyany
means,electronic,mechanical,photocopying,recording,scanningorotherwise,exceptaspermittedunderSections
107or108ofthe1976UnitedStatesCopyrightAct,withouteitherthepriorwrittenpermissionofthePublisher,or
authorizationthroughpaymentoftheappropriateper-copyfeetotheCopyrightClearanceCenter,222Rosewood
Drive,Danvers,MA01923,(978)750-8400,fax(978)646-8600.RequeststothePublisherforpermissionshouldbe
addressedtothePermissionsDepartment,JohnWiley&Sons,Inc.,111RiverStreet,Hoboken,NJ07030,(201)
748-6011,fax(201)748-6008,oronlineathttp://www.wiley.com/go/permissions.
LimitofLiability/DisclaimerofWarranty:Thepublisherandtheauthormakenorepresentationsorwarrantieswith
respecttotheaccuracyorcompletenessofthecontentsofthisworkandspecificallydisclaimallwarranties,
includingwithoutlimitationwarrantiesoffitnessforaparticularpurpose.Nowarrantymaybecreatedorextended
bysalesorpromotionalmaterials.Theadviceandstrategiescontainedhereinmaynotbesuitableforevery
situation.Thisworkissoldwiththeunderstandingthatthepublisherisnotengagedinrenderinglegal,accounting,
orotherprofessionalservices.Ifprofessionalassistanceisrequired,theservicesofacompetentprofessionalperson
shouldbesought.Neitherthepublishernortheauthorshallbeliablefordamagesarisingherefrom.Thefactthatan
organizationorWebsiteisreferredtointhisworkasacitationand/orapotentialsourceoffurtherinformation
doesnotmeanthattheauthororthepublisherendorsestheinformationtheorganizationorWebsitemayprovide
orrecommendationsitmaymake.Further,readersshouldbeawarethatInternetWebsiteslistedinthisworkmay
havechangedordisappearedbetweenwhenthisworkwaswrittenandwhenitisread.
ForgeneralinformationonourotherproductsandservicespleasecontactourCustomerCareDepartmentwithinthe
UnitedStatesat(877)762-2974,outsidetheUnitedStatesat(317)572-3993orfax(317)572-4002.
Trademarks:Wiley,theWileylogo,Wrox,theWroxlogo,WroxProgrammertoProgrammer,andrelatedtrade
dressaretrademarksorregisteredtrademarksofJohnWiley&Sons,Inc.and/oritsaffiliates,intheUnitedStates
andothercountries,andmaynotbeusedwithoutwrittenpermission.Microsoft,SharePoint,andSilverlightare
trademarksorregisteredtrademarksofMicrosoftCorporationintheUnitedStatesand/orothercountries.Allother
trademarksarethepropertyoftheirrespectiveowners.WileyPublishing,Inc.isnotassociatedwithanyproductor
vendormentionedinthisbook.
Wileyalsopublishesitsbooksinavarietyofelectronicformats.Somecontentthatappearsinprintmaynotbe
availableinelectronicbooks.
Fox ffirs.tex V3-01/30/2009 5:09pm Pagev
ToNicole,forputtingupwithmy‘‘quiettime’’whentryingtowritethisbook.
—SteveFox
Tomywife,Rosa,whoallowedmetimeawaytowriteduringacoast-to-coastmove,
buyingandsellingahome,abrokenfinger,andanewbabygirl.Withouthersupportandunderstanding,
thisbookwouldnothavebeenpossible.
—PaulStubbs
Fox f01.tex V3-01/30/2009 5:07pm Pagevi
About the Authors
Steve Fox has beenin the IT industry for morethan 12years,working in various areasincluding
searchandnaturallanguage,webdevelopment,andmorerecentlyOfficeandSharePointdevelopment.
He currently works for Microsoft as a Senior Technical Evangelist. When not working, he enjoys
sports—especiallyhockey—aswellasmoviesandwriting.HeishopefulthattheBuffaloSabreswill
onedaywintheStanleyCup.HecurrentlylivesinSeattle,Washington.
PaulStubbsisaSeniorArchitectEvangelistinthePlatformArchitectureTeamwithintheDeveloper
andPlatformEvangelistgroupatMicrosoft.Hefocusesonsolutionsarchitecturewithanemphasison
informationworkerproductivity,business-to-customer(B2C)solutions,andWeb2.0socialnetworking.
PaulhasalsoworkedwithseveralothergroupsatMicrosoft.Hehelpedshipthefirstandsecondversions
ofVisualStudioToolsforOffice(VSTO)andVisualStudioToolsforApplications(VSTA),whereinhe
developedanewmanagedcodeapplicationprogrammabilitydevelopmenttoolforInfoPath2007.He
alsodevelopedprogrammabilityfeaturesforfutureversionsofMicrosoftOfficefortheGrooveteam.
Fox f02.tex V3-01/30/2009 5:08pm Pagevii
Credits
AcquisitionsEditor VicePresidentandExecutiveGroupPublisher
KatieMohr RichardSwadley
DevelopmentEditor VicePresidentandExecutivePublisher
MaureenSpears BarryPruett
TechnicalEditor AssociatePublisher
LaurenceMoroney JimMinatel
SeniorProductionEditor ProjectCoordinator,Cover
DebraBanninger LynseyStanford
CopyEditor Proofreader
CateCaffrey NancyCarrasco
EditorialManager Indexer
MaryBethWakefield J&JIndexing
ProductionManager
TimTate
Fox f03.tex V3-01/30/2009 5:08pm Pageviii
Acknowledgments
Ittakesmanypeopletoputtogetherabooklikethis,andoftenthisworkgoesunseentothereader.I’d
firstliketothankthestaffatWileyfordoingagreatjobofkeepingusontrackandmakingsurethatour
contentwasstrongandmovedalongattherightpace.I’dliketoespeciallythankMaureenforkeeping
thewhipcrackingandKatieforbelievinginthisprojectinthefirstplace.Thereare,I’msure,many
othersatWileywhotouchedthisbookinsomeway,andforthoseofyouIdidn’thavedirectcontact
withbutwhodidworkonthisbook,thanks!I’dsecondlyliketothankLaurence,actingasourTechnical
Reviewer,whoraisedgreatquestionsalongthewaybutkeptusontrackandmadethebookwhatIsee
asamuchbetterfinishedproduct.Andlastly,thankstothefolksatMicrosoftwhohelpedusalongthe
way—whetheritwasansweringquestionsonforums,reviewingcontent,orspendingafewminutes
respondingtooure-mails.
—SteveFoxandPaulStubbs
Fox ftoc.tex V3-01/30/2009 5:17pm Pageix
Contents
Introduction xiii
Chapter 1: Introduction to Silverlight 1
DesignerandDeveloperConvergence 1
OverviewofXAML 2
SilverlightCode-Behind 9
DeveloperEnvironmentandTools 13
ChangingtheMIMEType 13
Editingtheweb.configFile 14
CopyingtheSilverlightDLLtoYourGAC 18
WhySilverlightandSharePoint? 18
Summary 20
AdditionalReferences 20
Chapter 2: Your First Silverlight and SharePoint Integration 23
DifferentWaystoIntegratewithSharePoint 23
CreatingtheSilverlightApplication 25
SilverlightSolutionProjectFiles 26
CreatingtheSilverlightApplicationCode-Behind 37
CreatingandDeployingtheSharePointWebPartHostContainer 47
CreatingtheWebPartProject 47
AddingReferencestotheProject 48
ConfiguringtheWebPartProjectforDeployment 51
AddingtheSilverlightVideoPlayerApplicationtotheSharePointSite 52
TroubleshootingTips 55
Summary 56
AdditionalReferences 56
Chapter 3: Creating Custom Field Types 57
Lists,Columns,andCustomFieldTypes 57
UsingListTemplatesandCustomerLists 58
DevelopingYourFirstCustomFieldType 62
CreatinganASP-BasedCustomFieldType 63
DevelopingaSilverlight-BasedCustomFieldType 75
Description:Having worked with both products,individually, it was nice to find published work on the collaboration of Sharepoint and Silverlight. The text is an easy read and the examples are well described. If you're new to either of the technologies, this is the book for you.
My only criticisms: the cover pri