Here we will see how to create a Summary Property using LightSwitch Visual Studio 2012.
The following is the procedure to create a Summery Property in LightSwitch.
Step 1
Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer.
![solution.jpg]()
Right-click on "Data Sources" and choose "Add Table".
![add table in comp.jpg]()
The table appears in the table designer window. Insert the records in the following table.
![table without comp prop.jpg]()
Step 2
In the table designer, add the Computed Property from the menu bar as shown in the figure.
![computed prop.jpg]()
The computed property will be added to the table. Provide some name to the computed property.
![tab with comp prop.jpg]()
This will set the "Is Computed" property in the property window and click on the Edit Method link.
![edit.jpg]()
Write the following code in the Code Designer:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.LightSwitch;
namespace LightSwitchApplication
{
public partial class Emp
{
partial void FullName_Compute(ref string result)
{
result = this.FName + "," + this.LName;
}
}
}
Step 3
In order to set the "Summary Property", select the table name and then go to the property window, under the Summary Property select the "Full Name" under the dropdown list of the summary properties.
![summary prop.jpg]()
Step 4
Right-click on Screens and choose "Add Screen".
![Add src comp.jpg]()
The Add New Screen dialog box appears. Select the "List and Details Screen" from the Screen Template, under screen information, choose "Emp" under screen data and provide some name to the Screen and click OK button.
![src desi comp.jpg]()
The Screen Designer appears as shown below.
![src desi list.jpg]()
Step 5
From the screen designer, select the Full Name, and after that go to the property window and mark the "Show as Link "checkbox as checked from the property window.
![full name prop win.jpg]()
Press F5 in order to run the application. Click on the "+" button and provide the information as shown below.
![out1.jpg]()
We will see that the data will be added as shown.
![out2.jpg]()