Friday, July 31, 2009

SilverLight Interview Questions

What are the types of containers in silver light?
dock panel-dock panel is used to arrange a set of objects around the edges of panel. Dock Panel’s Dock property enables you to specify the location of objects inside Dock Panel. If you set the LastChild Fill property to true (the default value) and the last element is allowed to resize, the last element added to the panel will resize to fill the remaining space. If the last element is set to a specific size, the last element will be set to the specified size and positioned in the middle of the remaining space. The order in which elements are added to the dock panel is important.
Wrap Panel-Wrap panel is used to wrap the content in the next line.

What is silverlight .js file?
silverlight.js is a helper file is used when adding a silverlight application to a web page via javascript .It contains more helper method like get silverlight,ongetsilverlight,etc.We can add silverlight application to a web page by an alternate way asusing objecttag in html element

Does Silverlight support ADO.NET? and How to load the data to Silverlight from database?
It Does not support .have to use via WCF service,

How to use the styles in Silverlight? Can we load the external CSS file into Silverlight?
NO, it is not possibel to load external css in silverlight.We can use setter property to in app.xaml to apply the style.
For ex:
In app.xaml
style x:Key="titleBorder" TargetType="Border"
setter property="Background" value="#ff0000"
if we r using brush then use Setter.value under
To use in the page
border style="{staticresource TitleBorder}>
textBlock text="GetData" style="{staticresource titleborder}"

can we use more than one xaml file in same project? explain?
yes we can use.To redirect from one xaml to other xaml
App app = (App)Application.Current;
app.UserName = txtUser.Text;
App.GoToPage(new Page2());

public static void GoToPage(UserControl nextPg)
App app = (App)Application.Current;
// Remove the displayed page
// Show the next page
to pass the parameter u can created property class and assign the value before passing parameter