Category Archives: C#

Filtering AutoComplete Boxes

In this example I have a search screen listing all the streets in the database with 3 autocomplete boxes for filtering – Continent, Country and City. When the user selects Continent, only those countries and cities within the continent should be listed in the auto complete box. Same for when a country is select, only cities within that country should be available within the city autocomplete box. Focusing just on the filter boxes, here is the quick version: Continue reading


Returning Records With Children

Here I have a screen for searching Street addresses.  Tables are Continent, Country, City and Street.

The database contains many Countries and Cities which do not have addresses. To make the user experience better I only want to load the autocomplete boxes with Countries and Cities that have addresses. Continue reading

Globals In LightSwitch

I looked around the ‘net for how/where to create global variables in LightSwitch and one post showed how to do it for VB. For the life of me I couldn’t figure out how to do this in C#, so I decided to do it this way which I probably better anyway. It keeps more separation between native LightSwitch generated code and my own, which is probably what LS designers intended. Continue reading

Simple Show/Hide Of Screen Elements

LightSwitch uses the MVVM architechture which means everything is about data and has barely any abstraction between data and presentation layers.

In this example we have a cities table with columns visible_portal, pixel_x and pixel_y. When visible_portal is false, the pixel fields should be hidden from the screen. When visible_portal is true, they should be displayed on-screen and made mandatory. Continue reading