Coding For a Living


A place to share and comment about coding for a living.

Windows 8.1 Hub Control Mike McIntyre

New in Window 8.1 is the JavaScript UI Hub control that provides a hierarchical system of navigation based on the hub pattern.

imageWith the Hub control you can create a hub page.

This pattern is best for apps with large content collections or many distinct sections of content for a user to explore.

The essence of hub design is the separation of content into different sections and different levels of detail. Hub pages are the user's entry point to the app. Here content is displayed in a horizontally or vertically panning view that enables users to get a glimpse of what's new and available. The hub consists of different categories of content, each of which maps to the app's section pages. Each section should bubble up content or functionality. The hub should offer a lot of visual variety, engage users, and draw them in to different parts of the app.

Windows 8.1 Back Button Mike McIntyre

Windows 8.1 includes the new Back button control. The BackButton provides a way for you to add backward navigation to your app.

<button data-win-control="WinJS.UI.BackButton" >button>

You don't have to write any code.  The BackButton automatically checks the navigation stack to determine whether the user can navigate backwards. If there is nothing to navigate back to, the button disables itself. When the user clicks the button or uses keyboard shortcuts (such as Alt+Left or the BrowserBack keys), it automatically calls the WinJS.Navigation.back function to navigate backwards.

A Better Windows 8 Mike McIntyre


Windows 8.1, a free upgrade for Windows 8 users, has features to make it more familiar to users of previous versions of Windows plus new features and functionality.

The Windows 8.1 update was released last Thursday, October 17, 2013.

It is a free download available from the Windows Store.


Opening the black box with Microsoft® Roslyn Mike McIntyre


Until now the VB and C# compilers have been black boxes, un accessible to Microsoft.Net developers.

Enter Microsoft Roslyn, “a set of APIs for exposing the Microsoft C# and Visual Basic .NET compilers as services available at runtime.”

This software is currently available as a community technology preview (CTP).

Roslyn can be imagined as a “compiler as a Windows service” which VB and C# developers can access through the new Roslyn APIs.

It allows the entire compile-execute process to be invoked from within .Net applications to, for example, give VB and C# a dynamic languages ability to generate and invoke code at runtime.

Or, how about incorporating Roslyn into a .NET application that accepts user input then uses Roslyn APIs to process the input (remember how good old class VB could evaluate a string?)

Roslyn is powerful but you won’t know how powerful it is until you try it out yourself.

Download it today!

Responsive and Modern UI with CSS for WinJS Apps Mike McIntyre

Rachel Apel has written a concise easy to understand article about building a responsive and modern UI with CSS for WinJS apps.


The Windows Library for JavaScript is a library of CSS and JavaScript files. It contains JavaScript objects, organized into namespaces, designed to make developing Windows Store app using JavaScript easier. Windows Library for JavaScript includes objects that help you handle activation, access storage, and define your own classes and namespaces.


In Rachel's article includes plenty of good examples of markup, designer, and code which show how CSS for WinJs apps can be used to create a modern responsive design.


Read the article: Build a Responsive and Modern UI with CSS for WinJS Apps

BrowserSwarm Testing Tool Mike McIntyre

Developed in collaboration with AppendTo and Sauce Labs, BrowserSwarm is powered through the cloud, allowing developers to save time setting up multiple browser or device testing environments and precious server resources, Microsoft said.

Read More

Visual Studio 2013– New and Improved Mike McIntyre

Visual Studio 2013 is new and improved.

Visual Studio 2013 provides support for Windows 8.1 App development.

It includes features to make it easier to develop across all Visual Studio languages and platforms:  tools, controls and templates, new Coded UI test support for XAML apps, UI Responsiveness Analyzer and Energy Consumption profiler for XAML & HTML apps, enhanced memory profiling tools for HTML apps, and improved integration with the Windows Store. image

Blend for XAML has been enhanced with significant new capabilities for Windows Store app design. Blend includes the addition of rulers and custom guides for more precise content layout as well as improved styling capabilities. Blend for HTML also inherits these enhancements and adds specific new capabilities for building Windows Store apps with HTML, such as the new timeline for animating changes in CSS.

Visual Studio 2013’s One ASP.Net unifies your web project experience so that you can create ASP.NET web applications using your preference of ASP.NET component frameworks in a single project. This new unified experience includes the ability to easily create hybrid applications that include improved versions of ASP.NET WebForms, MVC or Web API, all in a single project. Now you can mix and match the right tools for the job within your web projects, giving you increased flexibility and productivity when developing for the web.

‘Browser Link’ syncs HTML and CSS changes in Visual Studio with one or more open browsers‘Browser Link’ allows you to connect Visual Studio 2012 to one or more open browsers.

Code Brain Mike

My Code Brain page hosts a cloud full of code for C#, Visual Basic, JavaScript, HTML, CSS and more.

  • To use it, click the Code Brain link in the main menu.
  • Click nodes to drill down into the code.
  • Click the Code Brain link at the top to return to the top of the cloud.
  • Click the other links along the top to dive into C#, Visual Basic, etc.
  • Don't forget to use the search box.


Visual Basic WPF Using the Microsoft.Ink Library Mike McIntyre

Incorporating digital ink into Visual Basic WPF applications is done with the Microsoft.Ink DLL. Ink has evolved COM and Windows Forms to full integration into the WPF. You do not need to install separate SDKs or runtime libraries.

Below is an example of using procedural code with Ink. Ink can also be used with XAML.

Imports Microsoft.Ink Public Class Form1 Dim WithEvents myInkOverlay As InkOverlay Dim selectedMode As InkOverlayEditingMode Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() myInkOverlay = New InkOverlay(Panel1) myInkOverlay.Enabled = True End Sub 'Back of pen erase Sub CursorInRangeEventHandler(ByVal sender As Object, ByVal e As InkCollectorCursorInRangeEventArgs) Handles myInkOverlay.CursorInRange 'If the pen is inverted, set mode to "delete" If (e.Cursor.Inverted) Then myInkOverlay.EditingMode = InkOverlayEditingMode.Delete Else 'Pen is not inverted, so select whatever mode the user requested myInkOverlay.EditingMode = selectedMode End If End Sub 'Ink mode radio button Sub InkRadioClickedHandler(ByVal sender As Object, ByVal e As EventArgs) Handles RadioButton1.CheckedChanged If (RadioButton1.Checked) Then selectedMode = InkOverlayEditingMode.Ink DoModeChange(InkOverlayEditingMode.Ink) End If End Sub 'Select mode radio button Sub SelectRadioClickedHandler(ByVal sender As Object, ByVal e As EventArgs) Handles RadioButton2.CheckedChanged If (RadioButton2.Checked) Then selectedMode = InkOverlayEditingMode.Select DoModeChange(InkOverlayEditingMode.Select) End If End Sub 'Delete mode radio button Sub DeleteRadioClickedHandler(ByVal sender As Object, ByVal e As EventArgs) Handles RadioButton3.CheckedChanged If (RadioButton3.Checked) Then selectedMode = InkOverlayEditingMode.Delete DoModeChange(InkOverlayEditingMode.Delete) End If End Sub 'Wire up delete mode buttons 'Delete entire stroke Sub StrokeRadioClickedHandler(ByVal sender As Object, ByVal e As EventArgs) Handles RadioButton4.CheckedChanged 'Can be called during Form construction, prior to myInkOverlay instantiation If (myInkOverlay Is Nothing) Then Return End If If (RadioButton4.Checked) Then myInkOverlay.EraserMode = InkOverlayEraserMode.StrokeErase End If End Sub 'Delete point(s) at pen tip only Sub PointRadioClickedHandler(ByVal sender As Object, ByVal e As EventArgs) Handles RadioButton5.CheckedChanged If (RadioButton5.Checked) Then myInkOverlay.EraserMode = InkOverlayEraserMode.PointErase End If End Sub Sub DoModeChange(ByVal NewMode As InkOverlayEditingMode) 'Can be called during Form construction, prior to myInkOverlay instantiation If (myInkOverlay Is Nothing) Then Return End If 'Switch the collection mode myInkOverlay.EditingMode = NewMode 'Switch the radio buttons to reflect new mode Select Case NewMode Case InkOverlayEditingMode.Ink RadioButton1.Checked = True RadioButton2.Checked = False RadioButton3.Checked = False Case InkOverlayEditingMode.Select RadioButton1.Checked = False RadioButton2.Checked = True RadioButton3.Checked = False Case InkOverlayEditingMode.Delete RadioButton1.Checked = False RadioButton2.Checked = False RadioButton3.Checked = True Case Else Throw New ArgumentOutOfRangeException() End Select End Sub End Class

Visual Basic ServiceContractAttribute Class Mike McIntyre

The recommended way to create a Windows Communication Foundation (WCF) contract is with an interface. Acontract specifies the collection and structure of messages required to access the operations the service offers.

The ServiceContractAttribute class is used to indicate that an interface or a class defines a service contract in a Windows Communication Foundation (WCF) application.

A class can support multiple contracts by deriving and implementing multiple interfaces decorated with the ServiceContract attribute.

<ServiceContract> _ Interface IMyContract <OperationContract> _ Function MyMethod() As String End Interface <ServiceContract> _ Interface IMyOtherContract <OperationContract> _ Sub MyOtherMethod() End Interface Class MyService Implements IMyContract Implements IMyOtherContract Public Function MyMethod() As String Implements IMyContract.MyMethod End Function Public Sub MyOtherMethod() Implements IMyOtherContract.MyOtherMethod End Sub End Class