Create Secondary Tiles from your Desktop Application

Starting from the Insider Preview Build 16199 you can create SecondaryTiles directly from your desktop application by leveraging the Desktop Bridge.

A secondary tile provides a consistent, efficient way for users to directly access specific areas within a packaged app from the Start screen. Although a user chooses whether or not to "pin" a secondary tile to the Start screen, the pinnable areas in an app are determined by the developer.
Adding a Secondary tile from your WPF or Winforms is very similar to a pure UWP application, however there are few things to remember;
If you have a Win32 desktop application or a desktop application you need to specify your main window handle (HWND) in the API. The SecondaryTile displays a modal dialog to the user to get a confirmation from the user. If a desktop application does not configure the SecondaryTile object to specify the owner window for modal dialogs, this object will return inaccurate data or errors.


To configure a SecondaryTile object in a desktop application that uses the Desktop Bridge, follow these steps;

1. Do one of the following to enable your app to access the IInitializeWithWindow interface:
o If your application is written in a managed language such as C# or Visual Basic, declare the IInitializeWithWindow interface in your app's code with the ComImport attribute as shown in the following C# example. This example assumes that your code file has a using statement for the System.Runtime.InteropServices namespace.

public interface IInitializeWithWindow
  void Initialize(IntPtr hwnd);

o If your application is written in C++, add a reference to the shobjidl.h header file in your code. This header file contains the declaration of the IInitializeWithWindow interface.

2. Create the secondary tile (it is the same code you will write in UWP);

Uri square150x150Logo = new Uri("ms-appx:///Assets/square150x150Tile-sdk.png");
SecondaryTile tile = new SecondaryTile("SecondaryTileId" + PhotoListBox.SelectedIndex,

3. Cast the object to an IInitializeWithWindow object. Then, call the IInitializeWithWindow.Initialize method, and pass the handle of the window that you want to be the owner for the modal dialog. The following C# example shows how to pass the handle of your app's main window to the method.

IInitializeWithWindow initWindow = (IInitializeWithWindow)(object)tile;

The full sample is available on GitHub, here.
To learn more about Secondary tiles and the Desktop Bridge, check out the resources below;



Any questions? Leave them in the comments!

Vladimir Postel, Program Manager – Windows Developer Platform