Articles → LIGHT SWITCH 2011 → Adding Silverlight control in lightswitch 2011

Adding Silverlight control in lightswitch 2011

Software requirement

Prerequisite knowledge

Why do we need custom controls in Lightswitch?

Table creation

Picture showing design view of LoginInformation table

Click to Enlarge

Login screen

Picture showing the design view of login screen in Lightswitch

Click to Enlarge

Add Silverlight library project type

Picture showing a pop up to select Silverlight version.

Click to Enlarge

Picture showing the project structure once project is created

Click to Enlarge

Add a password control

Picture showing PasswordControl XAML file in project explorer window

Click to Enlarge

<UserControl x:Class="MyControl.PasswordControl"
   d:DesignHeight="40" d:DesignWidth="210">
   <Grid x:Name="LayoutRoot" Background="White">
      <PasswordBox x:Name="PasswordCtrl" Width="200" Height="30"></PasswordBox>

Add binding to password control

<PasswordBox x:Name="PasswordCtrl" x:FieldModifier="public" Width="200" Height="30"  
   Password="{Binding Path=Screen.LoginInformationProperty.LoginPassword,Mode=TwoWay}"></PasswordBox>

Add a custom control in Lightswitch screen

Picture showing how control is changed to custom control

Click to Enlarge

Picture showing the property window for login password control

Click to Enlarge

Picture showing a popup window for adding Silverlight control in Lightswitch application

Click to Enlarge

Save value in database

Picture showing the window for adding records when we run the application

Click to Enlarge


Picture showing the record list as an output

Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Saturday, June 16, 2012


Your Email Id  
Query/FeedbackCharacters remaining 250