Some of the basic ways on how to use the Auto Complete Box of Microsoft Ligthswitch.
1. Auto Complete Box from a foreign key.
This is the most basic way of using the Auto Complete Box. If you define a foreign key in your table, Microsoft Ligthswich will automatically make that field an Auto Complete Box.
In the above example we define a foreign key in the trnSalesItem table that links to our mstItem.
As you can see Microsoft Lightswitch automatically set the field mstItem as an Auto Complete Box.
2. Auto Complete Box from a local variable or a field with choice list.
The other way of using an Auto Complete Box is to define a local variable or a field with a Choice List.
- 1. Created a local variable called Month
- 2. In the property of the local variable I click the Choice List
- 3. Filled the Choice List with data, in my example, months of the year
- 4. Automatically Microsoft Lightswitch will make my Month an Auto Complete Box
You can also do this at the EF level, just provide a choice list to any field.
3. Auto complete box from a property.
I use this a lot as filter for my grid. Remember when you add a local variable you are not limited to just the native variables, e.g., String, int, etc., you can also use the tables (an EF feature).
- 1. Add a Data Item
- 2. Choose the Local Property and from the drop down list, choose a Table. In my example I choose a Sales Representative table.
- 3. The name of the local variable is Area and its type is the Table mstSalesRepresentative
- 4. Automatically Microsoft Lightswitch creates an Auto Complete Box for my Area local variable.
These are the most common ways of using an Auto Complete Box in Microsoft Lightswitch, hope you enjoy.
If you find this blog helpful, you can make the donation by clicking the Paypal button below.