Articles → LIGHT SWITCH 2011 → Close Browser Window In Lightswitch 2011

Close Browser Window In Lightswitch 2011

Software Requirement

  1. Visual studio 2010 is installed on your machine.
  2. Visual Studio 2010 service pack 1 is installed on your machine.
  3. Microsoft Visual Studio Light switch 2011 is installed on your machine.
  4. Silverlight runtime version 4 or 5 is installed on your machine

Prerequisite Knowledge

  1. How to create project using visual studio?
  2. How to create screens in lightswitch?
  3. What is the role of dispatcher in lightswitch?

Steps Of Execution

  1. Create a new project
  2. Add a new screen
  3. Add assembly and namespace
  4. Add a button
  5. Write code to close browser window

Create A New Project

Picture showing the sample lightswitch project in visual studio solution explorer
Click to Enlarge

Add A New Screen

Picture showing the Add New Screen window for adding the new screen in lightswitch
Click to Enlarge

Add Assembly And Namespace

Picture showing adding the reference of System.Windows.Browser in the project
Click to Enlarge

Add A Button

Picture showing adding the close button in the lightswitch designer window
Click to Enlarge

Write Code To Close Browser Window

partial void CloseButton_Execute() {
	Dispatchers.Main.BeginInvoke(() = >{
		// Write your code here.


Picture showing the output of the close browser window in lightswitch 2011
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Monday, August 5, 2013


Your Email Id  
Query/FeedbackCharacters remaining 250