Microsoft’s open source Windows Template Studio speeds up application development for the post-Win32s era Credit: Benjamin Nelan There’s a common question that’s asked any time a company rolls out a new set of SDKs or APIs: “How do I get started?” That’s not the real question, of course. At heart, it’s a placeholder for a more complex set of questions that boil down to this: It’s not a question of starting coding but a question of whether the platform can meet business needs. Anyone can code a Hello World app, but not every platform can deliver a line-of-business application. Microsoft’s Universal Windows Platform is a case in point. A refactoring of the familiar Win32 and .Net APIs, it’s intended to be the future of Windows application development. Alignment with the .Net Standard libraries makes it possible to use a single Visual Studio project to support both Windows desktop and cross-platform Xamarin applications, by keeping user interface code and core logic separate. But like all new platforms, there’s resistance to switching code to something new, especially when it’s focused on newer platforms. When old code runs on new platforms, there’s no incentive to begin a migration. So how can you start enterprise UWP development when Win32 is still a valid option? Introducing Windows Template Studio One option is to use an application builder to simplify that first build; using a tool to generate at the very least a scaffold that can support your application. That’s where the Windows Template Studio comes in, a tool for building a structure that can support both your business logic and your user experience, while adding support for key UWP features and for integration with cloud services. Released last year, it’s already at version 1.6, with each release adding new page options and support for additional UWP features. Microsoft has made the Windows Template Studio an open source project, hosted and downloaded from GitHub. Installed as a Visual Studio extension, it adds a new option to Visual Studio’s C# New Project dialog. Once you’ve chosen to build an app using Template Studio, you’re presented with a series of options that guide you through choosing an application layout, followed by the application framework you intend to use. The available layouts are simple: a basic navigation pane with a hamburger menu selection, a pivot view controlled by tabs, and a blank canvas. There’s a lot to be said for a relatively sparse selection of layouts, with the two main options covering most common use cases, and the third giving you a freeform layout ready for whatever you want to build. Constructing code scaffolding Once you’ve picked a layout, you can choose the appropriate framework for your code. Currently, there are four options: the familiar code-behind model Microsoft has used for XAML-based .Net applications since Windows Vista, plus with three different approaches to the common MVVM (Model-View-ViewModel) design pattern. It’s not surprising that Microsoft has chosen MVVM as the basis for Windows Template Studio applications, because it’s a good fit for the combination of XAML and C#. Two of the MVVM options come from third parties: MVVM Light and Caliburn.Micro. Like Microsoft’s own open source software, both use the MIT license, so there shouldn’t be any problem using them in your code. Once you’ve chosen your layout and framework, you can start to flesh out the skeleton of your app with pages. Like most modern applications, the Windows Template Studio builds on the page model used by most web apps. It’s an approach that makes it easy to go from C# app running on a PC to a Xamarin app on a mobile device to a web application, all running from the same back end. You’re not limited to a single page; you can use Windows Template Studio to add multiple pages to your app, with support for familiar application elements, including grid and master/detail pages, as well as charts and maps. Currently, 11 page types are available, with more added with each release. Some page types access specific UWP features, such as device camera, but most give you a basic page layout with support for a specific application feature. The Chart and Grid options use Telerik’s free UWP controls (which are also open source, under an Apache license), giving you a feel for how to use third-party UWP components in your code. Quick access to UWP features Although building an app skeleton is important, there’s a lot more to UWP. That’s where the Features section of Windows Template Studio comes in, adding code to support any of 16 separate UWP features. These cover basic user interactions, such as support for displaying information the first time an app runs and when it’s updated. Other options include support for deep links via your own custom URIs and for Windows 10’s various notification tools. Perhaps the most important aspects of its UWP feature support are how it simplifies adding key application life cycle elements. UWP builds on the WinRT model introduced with Windows 8, which added features to enable apps to roam settings through the cloud, as well as suspending and resuming rather than shutting down. Windows Template Studio adds code to support these features, as well as support the use of in-process background processes, which can work with remote services even while an application is running in the background. While a background task runs, data updates and users see any changes—without you having to write a separate background service to support your code. A scaffold ready for your UWP code Once you’ve completed a pass through the Windows Template Studio wizard, it creates the scaffolding for your code, which you can then fill out with your own code and your own XAML. There’s a lot to be said for getting a jumpstart like this, going from a wizard to an outline app in a few clicks. Although Windows Template Studio simplifies the building of UWP applications, it’s not a replacement for the now-discontinued Visual Studio LightSwitch LOB application builder. Tools like LightSwitch and its near codeless kin PowerApps are a modern take on the 4GL epitomized by languages like Forte. Windows Template Studio isn’t a tool for building form-based applications with minimal code; it’s more a way of quickly putting together the framework that can host your business logic in a UWP app. If you’re ready to go beyond simple application builders, Windows Template Studio is well worth investigating. You can do a lot more with a foundation like this, because the code it produces will support not just your first UWP app but also future releases as you add new features. Related content feature 14 great preprocessors for developers who love to code Sometimes it seems like the rules of programming are designed to make coding a chore. Here are 14 ways preprocessors can help make software development fun again. By Peter Wayner Nov 18, 2024 10 mins Development Tools Software Development news JetBrains IDEs ease debugging for Kubernetes apps Version 2024.3 updates to IntelliJ, PyCharm, WebStorm, and other JetBrains IDEs streamline remote debugging of Kubernetes microservices and much more. By Paul Krill Nov 14, 2024 3 mins Integrated Development Environments Java Python analysis Understanding Hyperlight, Microsoft’s minimal VM manager Microsoft is making its Rust-based, functions-focused VM tool available on Azure at last, ready to help event-driven applications at scale. By Simon Bisson Nov 14, 2024 8 mins Microsoft Azure Rust Serverless Computing analysis GitHub Copilot learns new tricks GitHub and Microsoft have taken their AI-powered programming assistant into new territories, tackling code reviews, simple web apps, Java upgrades, and Azure help and troubleshooting. By Simon Bisson Nov 07, 2024 8 mins GitHub Java Microsoft Azure Resources Videos