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 Mail Link control MailLink and The Web Link control WebLink

These two controls are very similar, so are described together.

Lightswitch allows you to include mail and web addresses as screen data, and even includes controls for editing email addresses, but does not supply any built-in way of providing the sort of clickable links that people are used to seeing. These two controls fill that gap...

The Mail Link and Web Link controls in action

In the picture above, the email field is shown using the Mail Link control, without an image being supplied, and with the email address shown. In this example, the user can click the link to start a new email, but cannot edit the email address.

By contrast, the web address has been displayed to the right of a textbox where the user can edit the URL. The Web Link control has had an image set, and has been set so that the URL is not displayed. That way, there is just the clickable image on the screen.

Note that due to the way that data binding works in Lightswitch, if you use one of these controls as shown in the second example above, if the user changes the address in the textbox, the Mail Link or Web Link control will not see the modified address until they click or tab to another textbox (or whatever). If they change the address and immediately click the link, they will be taken to the address that was in the textbox before they changed it. It is possible to work around this by hooking up to the textbox's TextChanged event, and pushing the modified value into the link control, but this is a bit messy. Caveat emptor as they say in Chinese :)