Static Text in LightSwitch


Static means that something doesn't change. Static text is text that the user can't change or we can say text that remains constant on every document is called static text. The type of static text is a label. 

Step by step solution

Step 1 : Open Visual Studio LightSwitch->Right click on screen->Add new screen.

2nd.gif

Step 2 : Select list and details screen->Write screen name (Static text)->Select screen data none->Ok.

3rd.gif

Step 3 : Add new group.

5th.gif

Step 4 : Expand rows layout->Select columns layout.

6th.gif

Step 5 : Add data item->Select local property->Type (string)->Write name (Text )->Ok.

4th.gif

Step 6 : Move Text from static text screen to columns layout.

7th.gif

Step 7 : Now go to text property->Control type (Label)->Label position (None)->Font style (Heading 1).

8th.gif

Step 8 : Go to write code->Select statictext_InitializeDataWorkspace.

9th.gif

using
System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
namespace LightSwitchApplication
{
    public partial class StaticText
    {
        partial void StaticText_InitializeDataWorkspace(List<IDataService> saveChangesTo)
        {
            Text = "Welcome in Visual Studio LightSwitch 2011.......";
        }
    }
}

Step 9 : Run application (Press F5).

10th.gif

Up Next
    Ebook Download
    View all
    Learn
    View all