.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Interview Question >> Silverlight >> Post New Question Subscribe to Interview Questions

How to change the default page of a Silverlight application?

Posted By :Deco     Posted Date :September 23, 2010    Points :10   Category :Silverlight 
In a simple way we can set the default page, what we have to do is to change the default page of a silverlight application, we have to set the RootVisual property inside the Application_Startup event of the App.xaml file.

private void Application_Startup(object sender, StartupEventArgs e)
this.RootVisual = new MainPage();

You can also find related Interview Question to How to change the default page of a Silverlight application?  below: 

How you will Change application to full screen Mode in SilverLight?

Application.Current.Host.Content.IsFullScreen=true; (More...)

What is the best place to start Silverlight application?

There is no hard and fast rule to start Silverlight application. Every developer can start as per his/her experience.
like as per my case I always prefer Visual Studio. SO, in my view Visual Studio is the best place to start with Silverlight2 applications.Microsoft provides
templates for creating Silverlight applications and libraries in C#
and Visual Basic. (More...)

Can you elaborate how to start a silverlight application with Visual Studio?

You can find a fully described article from http://www.silverlightclub.com/resources/1858-silverlight-lets-start-building-applications.aspx.aspx
In the following step(s) I am giving the ideas all about:
1.Create a project:Here you just start your visual studio, Select your programming language [C#/VB], Choose Silverligh Template give the name and save it
2. Adding SIlverlight COntrols:One thing is happened here, controls cannot dragged onto the designer, you can draw/drag the controls on XAML page.
(a) Naming to control:In this step just give the name to your silverligt control like for Button you can give name as : btnmySilverligtButton
(b)Adding event handlers to Silverlight controls:Here you can give the event handlers like for click etc.
(c)Testing Silverlight applications in Visual Studio:Now just press F5 and test your application (More...)

What happened when I press F5 within Visual Studio to run Silverlight application?

When you run the Silverlight application within Visual Studio, a new folder created in the web-site project for silverlight solution and it happened only first time. The folder name is ClientBin and having package with XAP extension which contains compiled project. (More...)

Can I add more than one .xaml pages in silverlight application?

Yes, you can have multiple .xaml files in a single project.

In the App.xaml, in the method Application_Startup you can choose, which page you want to

initially display. (More...)

Does SessionID change with every request in the asp.net 2.0 application?

For any web programmer, its obvious to think and believe that SessionId remains same through out the user session and it was right till asp.net1.1. But in asp.net2.0, this behavior has changed. In the asp.net application new sessionid is returned with the response to every request until session objects are not used.

According to MSDN the reason/solution is:

"When using cookie-based session state, ASP.NET does not allocate storage for session data until the Session object is used. As a result, a new session ID is generated for each page request until the session object is accessed. If your application requires a static session ID for the entire session, you can either implement the Session_Start method in the application's Global.asax file and store data in the Session object to fix the session ID, or you can use code in another part of your application to explicitly store data in the Session object."

Enjoy. (More...)

Can you change the value of a variable while debugging a C# application?

Yes, if you are debugging via Visual Studio.NET, just go to Immediate window. (More...)

How can we change the default port?

From the Network Utility TCP/IP properties -> Port number.both on client and the server. (More...)

Is there a way to generate more then on .xap file from a same silverlight application.

Since for each .xap file we have to create a new silverlight application.

Can we add more than one master page to our web application?

Yes We can add more than one master page to our web application (More...)

Can you change the value of a variable while debugging a C# application?

Yes, if you are debugging via Visual Studio.NET, just go to Immediate window. (More...)

Can you change the value of a variable while debugging a C# application?

Yes, if you are debugging via Visual Studio.NET, just go to Immediate window. (More...)

You are working on an ASP.NET application. One of the drop down list contans 1 lakh records. The page posting becomes very slow. How to overcome this? You just need the selected index of the dropdownlist on submit.

Use EnableVieState=false. On the dropdown change event, set a hidden field value to the selected index.

Disabling view state helps us in reducing the postback load. (More...)

How can I change master page at runtime

The Pre_Init event is a key event to examine if we want to change the master page file programmatically.


using System;
using System.Web.UI;

public class BasePage : Page
public BasePage()
this.PreInit += new EventHandler(BasePage_PreInit);

void BasePage_PreInit(object sender, EventArgs e)
MasterPageFile = "~/Master1.master";

We get error "The 'MasterPageFile' property can only be set in or before the 'Page_PreInit' event." If we try to change master page in any other event than Pre_Init.


Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend