You are on page 1of 6

Silverlight Interview Questions and Answers (23)

IsADO.NETobjectssupportedinSilverlightProject? No,Silverlightprojectdoesn'tsupportnormalADO.NETobjectslikeDataTable,DataSet,DataColumn, DatabaseconnectionproviderslikeSqlConnection,OledbConnectionobjects. YoucanuseSystem.DatanamespacebutthatcontainsServicesrelatedstuffsnotADO.NETstuffs. Canweaddnormalprojectreference(normalclasslibrary)totheSilverlightproject? NOTE:Thisisobjectivetypequestion,Pleaseclickquestiontitleforcorrectanswer. Howcanstyleelementsbeapplied?(similartoaCSSfile/skins) Styleselementsaresupportedintheformofapplicationresources.Anapp.xamlfilecanbecreated containinganapplicationresourceXmlconstruct.Thetargettypeforeachstyleissettothecontrolon whichthestyleneedstobeapplied. App.xaml: <Application.Resource> <Stylex:Key="MyBorder"TargetType="Border"> <setterproperty="width"value="5"> </style> Page.xaml: <BorderStyle="{StaticResourceMyBorder}"> ... </Border> CanyouprovidealistofLayoutManagementPanelsandwhenyouwillusethem? CanvasPanel: useacanvasforsimplelayoutsandwhenthereisnoneedtoresizepanel.Controlscanoverlappedeach otherwhenresizingthepanel. stackPanel: usethisforgroupingcontrolsinastack(horizontal/vertical).Controlsdonotoverlapped. GridPanel:

Silverlight Interview Questions and Answers (23)


mostflexible,multirow/columnslayouts.SimilartoaHTMLtable HowtosetSilverlightcontentswidthas100%? Generallyyoucan'tsettheUserControlwidthin%like100%sothattheSilverlightcontentscanspread inthefullscreen. Togetthe100%widthofthescreenyoucansetwidth="auto"andheight="auto". WhichlanguageisusedtodesignthelayoutinSilverlight? TodesignthelayoutoftheSilverlightapplication,XAMLlanguageisused. ExtensibleApplicationMarkupLanguage(XAML,pronouncedzammel['zm??])isadeclarativeXML basedlanguagecreatedbyMicrosoftwhichisusedasauserinterfacemarkuplanguagetodefineUI elements,databinding,eventing,andotherfeatures. WhichprogramminglanguagecanbeusedtowritethebackendoftheSilverlightapplication? WecaneitheruseVisualC#orVisualBasictocodethebackendofthesilverlightapplication.Here backendmeansthecodebehindfilesfortheSivlerlightpages. WhenyoucreateanewprojectinSilverlightthroughVisualStudio,howmanyxamlfilesarecreatedand whataretheusesofthosefiles? WhenwecreateaSilverlightapplicationfromVisualStudio,two(2)xamlfilesarecreatedintothe Silverlightproject. Theyare: 1.App.xamlApp.xamlisafileusedtodeclaresharedresourceslikebrushes,variousstyleobjectsetc. andtohandletheglobalapplicationlevelevent(thisisalmostsimilartoglobal.asaxfileinasp.net application).BydefaultfollowingeventsarecreatedintheApp.xaml.csfile. Application_Startup Application_Exit Application_UnhandledException ReportErrorToDOM 2.MainPage.xamlorPage.xamlThispageisthedefaultpageoftheSilverlightapplicationandwhenthe silverlightapplicationrunsthisbecomesthedefaultpagetoappear(thispageislikethedefault.aspx pageofasp.netapplication)

Silverlight Interview Questions and Answers (23)


HowtochangethedefaultpageoftheSilverlightapplication? TochangethedefaultpageofSilverlightapplication,youneedtosettheRootVisualpropertyinsidethe Application_StartupevenofApp.xamlfile. privatevoidApplication_Startup(objectsender,StartupEventArgse) { this.RootVisual=newYourPage(); } WhatistheparentxamltagofSilverlightpage? UserControlistheparentxamltagoftheSilverlightpage.AllothertagsareplacedunderUserControl tag. <UserControlx:Class="SilverlightApplication2.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400"Height="300"> <Gridx:Name="LayoutRoot"Background="White"> </Grid> </UserControl> WhatistheuseofClientBinfolder? ClientBinfolderisusedtoplacethe.xapfileofSilverlightapplication.Youcankeepthisanywherein yourwebapplicationbutthisisthedefaultthatisusedbytheSilverlight. Whatisthe.xapfileinsideClientBinfolderofconsumingSilverlightapplication? FollowingisaverygoodFAQaboutthe.xappostedonasp.netpage. WhatdoesXAPmean?

Silverlight Interview Questions and Answers (23)


XAP(pronouncedZAP)isthefileextensionforaSilverlightbasedapplicationpackage(.xap).Thisfile containsthecompressedassembliesandresourcesofaSilverlight2application. Whatisa.xapfile? A.xapfileisaSilverlightbasedapplicationpackage(.xap)thatisgeneratedwhentheSilverlightproject isbuilt. WhyisXAPimportant? Tools,suchasVisualStudio2008withtheMicrosoftSilverlightToolsBeta2forVisualStudio2008,allow youtocreateSilverlightapplicationsthatareheavilyclientbasedusingmanagedcode.Youcanuse managedcode,suchasC#orVisualBasic,andbenefitbyusingthetoolsthatyouareusedtoworking with. HowdoesXAPwork? Onceyouhavecreatedthe.xapfile(explainedbelow),theSilverlight2plugindownloadsthefileand runsitinaseparateworkspace. HowdoIusea.xapfile? A.xapfileisusedtocontainandtransfertheassembliesandresourcesofamanagedcodeapplication. ThismanagedcodeapplicationmustberunwithintheSilverlight2browserplugin. Visithttp://forums.asp.net/t/1277554.aspxforcompletedetails. WhatisSilverlight.jsfile?

Silverlight Interview Questions and Answers (23)


Postedby:Raja Silverlight.jsisahelperfilewhichenablesWebsitestocreateadvancedSilverlightinstallationand instantiationexperiences. Formoredetailsvisithttp://code.msdn.microsoft.com/silverlightjs CanweaddthereferenceofaClasslibraryprojectinSilverlightapplicationproject? Postedby:Raja No,Youcan'taddthereferenceofaClasslibraryinsidetheSilverlightapplicationproject.Youcanonly addthereferenceofanotherSilverlightapplicationprojectinsideaSilverlightapplicationproject. However,youcanaddthereferenceofaWebServiceorWCFservices.

Silverlight Interview Questions and Answers (23)


HowtoperformEventhandlinginsilverlight?. Postedby:Naveen86 Silverlight1.0usesJavaScript,whileSilverlight2.0usesC#(managedcode)foreventhandling.Wewill bedescribingtheeventmodelforSilverlight2.0. TheeventhandlersaredefinedinthecodebehindfilethatbackstheXAMLdefinitionofyourUser Interface(UI),namelymypage.xaml.cs. TheSilverlightEventMode InSilverlight,therearetwoeventcases: Inputevents Noninputevents. InputEvents:ThebrowserthathoststheSilverlightpluginhandlesinitialinputstimulusfortheinput events.ThisisbecauseSilverlightworkswithinthepluginarchitectureofthehostingbrowser.Fromthe browser,theeventissenttotheSilverlightplugin. Then,itisraisedasaneventintheSilverlightObjectModel. NoninputEvents:Theyreportastatechangetoaparticularobject,forexample,thestatechange eventsthatreportasynchronousdownloadstateorprogressofactionsinitiatedbyWebClient.Some noninputeventsprovidelifetimeinformationofobjectsataframeworklevel. ForexampletheFrameworkElement.Loadedevent Someevents,suchasOnError,canonlybehandledbytheSilverlightplugininstanceandexistwithin theHTMLDocumentObjectModel(DOM).Theseeventsneedtobecontinuallyexposedandpossibly handledbyanyscriptworkingwiththeplugininstanceintheDOM.Therefore;theseeventsarenot passedtothemanagedprogrammingmodel.

You might also like