Pixata Custom Controls
For Lightswitch

Recent Posts

Popular tags (# posts in brackets)

Anonymous types (3) ASP.NET (5) C# (3) C# tricks and tips (2) Computers (6) Design patterns (3) DomainDataSource (3) Dynamic data (4) Entity framework (3) Entity model framework (5) F# (3) LightSwitch (12) Linq (6) Microsoft (2) MVP (2) MVVM (2) Project Euler (2) RIA services (5) Silverlight (2) SQL Server (4) Unit testing (4) Visual Studio (7) WCF (3) WPF (3)

Gratuitous link to StackExchange




The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Actually, as I'm self-employed, I guess that means that any views I expressed here aren't my own. That's confusing!


Theme modified from one by Tom Watts
C#/F# code styling by Manoli (for posts pre-2016) and Google code prettify (for post from Jan 2016 and beyond)

My rambling thoughts on exploring the .NET framework and related technologies

Please note that this blog has ben retired. Most of the material has been migrated to my new blog at www.pixata.co.uk. Please update your bookmarks to point to the new blog.

The Application Information control Application Information

Sometimes it's useful to show the name and version number of your application on a screen. Whilst you can do this by hard-coding the information (and remembering to change it every time you deploy), this is not a very efficient way of doing it.

There are code samples around that show you how to get the information dynamically, which avoids the maintenance problems, but hey, this is Lightswitch, life is supposed to be easy, right? Who wants to write code when you can just use a control?

The Application Information does this for you. Simply set the control type of a static property to Pixata Application Information, and then set the properties as you wish. There are only two of these, so it's pretty simple...

The Application Information control's properties in the designer

The Font Style property is the same as you get in any text-based control in Lightswitch, and enables you to choose what style of text size, etc you want.

The "Information to be displayed" property allows you to choose what application information the control should show. This can include a combination of the application name and version. When Lightswitch builds your application, it gives it a version number that has three parts. The major and minor parts are set by you in the project property pages...

The Lightswitch project's general properties

In the example above, the version is at the default value of 1.0, but in reality you should change this every time you deploy. In addition, Lightswitch adds a build number, which you cannot change, and will increase by one every time you deploy.

Here you can see the control on a screen, showing the application name and the full (ie major, minor and build) version number. The font style has been set to Heading1.

The Application Information control on a screen