MMS • RSS
Microsoft is positioning UWP for traditional line of business (LOB) applications with an emphasis on rapid application development (RAD) using the Windows Template Studio. But that’s not all they’re doing to entice LOB developers onto the UWP platform.
When it was originally released, the Universal Windows Platform (UWP) was seen solely as a way to sell applications through the Windows Store. The basic idea was you could write an application once and it would run on both Windows and Windows Phone. But it was also severely restricted, such that you almost had to go through the Windows Store. This made it untenable for Line of Business (LOB) applications, which naturally should never be exposed to the public.
In lieu of UWP, LOB developers either continued using “legacy” platforms such as WinForms and WPF, usually with ClickOnce as the deployment method. Or they accepted the additional complexity and development costs of an internal web site. This direction was especially popular with mid-sized and large companies where the higher deployment costs of WinForms/WPF were a factor.
With last year’s “Windows 10 Fall Creators Update”, the UWP model changed and it became possible to install UWP applications directly from a website. While not exactly the same experience as ClickOnce, at least it’s a start. Concurrently, Microsoft has had a team focused on making XAML/UWP more viable for LOB applications.
Windows UI Library
User controls are at the heart of any UI framework. The robust user control model was what made Visual Basic popular in the 1990’s and what continues to make desktop application development faster than HTML-based alternatives. But the deployment model for UWP brought with it some unnecessary limitations.
Since the main user controls, a.k.a. “platform controls”, were baked into the OS, applications had to be very conservative on when they adopted new controls. This is especially problematic for corporate environments where the machines, while running Windows 10, are often a release or two behind the general public.
To address this, platform controls are now being released as NuGet packages. This allows developers to utilize the new controls without waiting for the rest of the company to catch up on Windows releases. These NuGet packages require at least the Windows 10 Anniversary Edition from August of 2016.
These controls address well known gaps in the UWP ecosystem such as not having a tree-view, menu bar, or color picker.
As with .NET Framework and .NET Core, UWP now supports the .NET Standard 2.0. This will allow developers to move their business logic and data models into a .NET Standard library. From there they can share the same code in a traditional desktop application, website, or UWP app. In theory this will make migrating from WinForms/WPF to UWP much easier.
Microsoft describes the default spacing and sizing in UWP as “generous with lots of whitespace”. The Windows release planned for this year will change the defaults in order to free up more screen real-estate by automatically reducing the control sizes, padding between controls, the font sizes, and in general make everything more compact. They estimate you’ll be able to increase the amount of controls on the screen by roughly a third.
Developers can further reduce the size of the controls by choosing the compact mode. This reduces the spacing between controls by 40% and allows approximately 50% more data to be seen at one time. This feature is mostly directed towards data intensive, line of business applications.
It is well known having a pleasing color scheme makes users more confident in a tool. But with something as complex as UWP/XAML’s style model, there often isn’t enough time to even apply basic colors. Fundamentally, the problem is the style for each type of control needs to be updated separately and then tested against the overall theme. And there rarely is enough time for this when building a line of business application.
A new tool, tentatively called “Color Demo”, is meant to address this. Using simple color pickers, it can preview what the theme will look like and generate the necessary resource dictionaries to be included in the application.
Furthermore, it will warn when the color choices may cause problems like not having enough contrast to make text readable.
This still won’t be as rich as a fully styled XAML application, but it may provide enough polish to give the application a professional appearance.
Data Validation UI
Another glaring hole in UWP is the lack of data validation support. This is an odd oversight as data validation has been part of .NET UI frameworks since the very beginning. (We discuss some of these interfaces in the article Models and Their Interfaces in C# API Design.)
New for this year is the ability to use the INotifyDataErrorInfo interface along with attribute-based validation. When a model exposes this interface, the UI will be able to automatically display the correct error messages. The exact way it displays the error will depend on which mode you choose in the control.
Implementing INotifyDataErrorInfo isn’t exactly easy. There is a lot of boilerplate involved in attaching attribute-based validation to the INotifyDataErrorInfo interface. So, you may want to look at a MVVM framework that handles this for you. [One such example is this author’s Tortuga Anchor library.]
New XAML Controls: Data Grid
For non-UWP developer, it may seem rather remarkable no data grid is available out of the box.
For a line of business developer, it is almost unthinkable that a UI framework wouldn’t have a data grid. Even back in the mid-90s, a variant of this control was in the heart of countless business applications. Many developers considering UWP are surprised to learn that Microsoft hasn’t already ported a data grid from WPF or Silverlight.
Next week we’ll take a deeper look at the Windows Community Toolkit.