XAML

XAML

Episode Fourteen

XAML or eXtensible Application Markup Language allows developers to build applications that separate a rich user interface from the implementation including events, business objects and other code.

Intro

I'm Peter and this is the RoguePlanetoid Podcast where you will find insights about Microsoft or related platforms and technology, along with so much more whether you are beginner or an experienced professional or just interested in technology. Keep Current, Keep Coding!

Welcome

Welcome to episode fourteen of the RoguePlanetoid Podcast about XAML, XAML or eXtensible Application Markup Language allows developers to build applications that separate a rich user interface from the implementation including events, business objects and other code. XAML can define objects including vector-based controls that can be customised with styles and templates that can then be rotated or animated. XAML is an XML-based declarative markup language that decouples the design and user interface of an application from the implementation of an application including support for databinding to present or allow interaction with data.

I've used XAML with many different platforms including legacy and current implementations over the years or spoken about XAML at many different events from using it with Windows Presentation Foundation to Silverlight and from Windows Phone to Windows App SDK which uses XAML with C#. C# was covered in the previous episode of the RoguePlanetoid Podcast which you can also listen to if you haven't already or check out the link in the show notes.

Windows Presentation Foundation

Windows Presentation Foundation or WPF was the first platform to introduce eXtensible Application Markup Language or XAML as part of .NET Framework 3.0 in 2006, codenamed Avalon during development. XAML was a major shift away from the absolute positioned and fixed sized based user interfaces used in Windows Forms which was introduced in 2002 with .NET Framework 1.0. XAML in WPF allowed a user interface to be defined using an XML-based language which allowed for the business logic of an application to be separated from the implementation of an application written using VB.NET or C# to create applications for Windows.

Windows Presentation Foundation could display more complex graphics more easily and could even take advantage of the GPU to offload many graphics tasks and thanks to the use of vector-based controls and elements they could be scaled to any size or resolution. Databinding in WPF allowed for data to be bound to controls which could use one-way binding to display information or two-way binding to allow interaction, data binding could be used with every control from buttons to CheckBoxes and RadioButtons to ListBoxes. Databinding with WPF is also possible with custom controls by defining dependency properties or value converters can be defined to allow different values to be data bound such as a Bool to Visibility converter to control whether an element should be displayed or not.

Windows Presentation Foundation also supports other elements such as shapes which could have brushes from solid colours to gradients or could have transformations applied to them and more. It was also possible to easily use images, audio and video in applications written using XAML and WPF. Controls could be completely customised with control templates if you wanted to change how they look without changing the underlying behaviour of a control and for displaying data you can take advantage of Data Templates with controls such as ComboBox and ListBox. WPF also has flexibility in how to respond to interaction from controls with support for many of the events needed such as when a button is clicked or when a checkbox is selected but it is also possible to take advantage of commanding, which when combined with databinding allows for full separation of the interaction with the user interface from how that is handled in the code.

Windows Presentation Foundation also has the distinction today of not just being the legacy technology of .NET Framework, but also be a major part of the modern .NET ecosystem where developers today can create a WPF Application, by installing the development workload for Visual Studio 2022, and take advantage of the latest features of .NET along with being able to use XAML.

I have made use of Windows Presentation Foundation myself both when it was originally released as part of .NET Framework 3.0 and with modern .NET where it was great to be able to build more flexible and modern looking user interfaces. Not only that I used WPF in ways that you wouldn't expect when I created a template based static graphics rendering system for the web where I combined the web-based ASP.NET with the desktop-based WPF both using .NET Framework to create content at any size or resolution along with using WPF with Modern .NET to create a bespoke software application. If you want to find out more about using Windows Presentation Foundation, then you can visit github.com/dotnet/wpf or check out the link in the show notes.

Silverlight

In 2007, a year after the release of Windows Presentation Foundation and the introduction of XAML, that XAML was brought to the web with the introduction of Silverlight, which was codenamed Windows Presentation Foundation Everywhere or WPF/E. Silverlight 1.0 took advantage of XAML to bring many of the features of its desktop counterpart to the web but also added useful features such as digital rights management for video streaming, which was rarely supported at the time, however this first version used JavaScript.

Silverlight would finally combine the power of XAML and .NET with the release of Silverlight 2.0 in 2008 which included a version of the .NET Framework supporting the same Common Language Runtime as .NET Framework 3.0 which made it possible to port many applications from the desktop with Windows Presentation Foundation to the web using Silverlight in VB.NET or C#. Silverlight 3.0 would follow in 2009 and added more functionality and features as more and more developers were using Silverlight to create more complex applications. This version brought Silverlight back to the desktop with an out of browser experience to support running applications outside of the browser. Silverlight 4.0 was released in 2010 and added more features including webcam and microphone support and printing for out of browser experience applications. Silverlight 5.0 released in 2011 added GPU accelerated video decoding and additional media playback controls.

However, that would be the final release of Silverlight as improvements to HTML 5 and more modern browsers including features such as support for DRM-based video streaming meant Silverlight was no longer viable, along with competition from Adobe's Flash which was similar but had far greater support although it too would see an end. In 2021 support for Silverlight on the web and desktop ended with the final version of Internet Explorer, Internet Explorer 11. Silverlight which brought XAML and .NET to the web during its lifetime was supported on Microsoft's Internet Explorer, the predecessor of today's Microsoft Edge browser along with Firefox, Safari, and Chrome and with the out of browser experience in Silverlight it was possible to write applications for desktop on Windows and macOS using XAML and .NET.

I used Silverlight to create my own examples, many of which I had ported from Windows Presentation Foundation plus also used it to create my own web and desktop applications. This included one that allowed you to create graphic-based versions of the Zune Cards from the Zune Social, which was part of the Zune music platform Microsoft had at the time which allowed you to share what music you were listening to, and my app allowed you share your Zune Card in more places. Ironically those Zune Cards used Adobe Flash rather than Microsoft's own Silverlight so it was interesting to use their own technology to create that application! Silverlight's legacy lives on with bringing .NET to the browser with Blazor, although Blazor uses Razor and HTML rather than XAML, Blazor allows developers to create rich web applications much like those with Silverlight using modern .NET and thanks to Blazor Hybrid it is possible to target desktop applications on Windows and macOS just like with Silverlight. If you want to find out more about using Blazor then you can listen to Episode Six of the RoguePlanetoid Podcast about Blazor or check out the link in the show notes.

Windows Phone

Silverlight had reached its peak back in 2010 on the web and desktop but there would also be another platform that would take advantage of Silverlight, which would allow developers who were already familiar with that technology to bring their apps to mobile or to create new apps. It would be then CEO of Microsoft, Steve Ballmer, who said at the announcement of Windows Phone 7 Series as it was known at the time that every Silverlight developer was a Windows Phone developer and every developer including myself would want to put that to the test. Windows Phone 7 as it was known on release was the new device and platform from Microsoft, but it didn't support any existing Silverlight web applications and there was no support for Silverlight in the browser and any apps would need to be re-written. Windows Phone apps used the same XAML as Silverlight but there initially was only support for C# along with only supporting features that existed on the phone or took account of running on mobile with a special version of .NET although support for VB.NET did come later.

Windows Phone did however make it possible to take many applications that were written for the web or desktop with Silverlight and bring them to the mobile and leverage the existing knowledge of developers, along with bringing new developers and their applications to the platform which took advantage of a new design system codenamed Metro. Windows Phone itself was an innovative platform at the time including live tiles like today's widgets along with devices supporting always on displays and wireless charging common on many new high-end smartphones today. Despite these features it was hard for Windows Phone to compete with iOS and Android, which back then as they do now in 2024 dominated the smartphone market and many developers just didn't see the value in bringing their apps, which meant consumers didn't see the apps they were familiar with on Windows Phone so didn't buy them. Many developers did attempt to bring many apps themselves to the platform such as Instagram or YouTube, but those attempts were blocked even if they delivered the same functionality as their iOS and Android counterparts and bringing what users Windows Phone had to them too.

Windows Phone delivered a great experience for those developers who did attempt to create new apps or bring existing apps to the platform, such as first-class development tools using Microsoft's Visual Studio along with an emulator that ran the Windows Phone operating system itself. Even before Microsoft first released Windows Phone it was possible to try applications out on prototype hardware. Windows Phone's experience for developers improved even more with the release of Windows Phone 8 and Windows 8 in 2012 where it was possible to target application for either desktop or mobile using WinRT with XAML and C#. However, when Windows 8.1 and Windows Phone 8.1 were released in 2014, this made it possible for developers to target both desktop Windows and mobile with the same application, but this would be the final version of Windows Phone, although it would not be the end of Microsoft's attempts at targeting mobile.

I supported Windows Phone as a developer from the very beginning and it was due to Windows Phone why I switched from VB.NET to C# as that was the only language supported at the time, but it was a great decision as I still use C# to this day. I was, just like the former CEO of Microsoft, Steve Ballmer said, able to bring my Silverlight skills from the web and desktop to mobile with the release of Windows Phone. I created two applications for the Windows Phone platform with their XAML-based user interfaces taking advantage of Metro, later known as Modern Design Language. This included ZuneCardr which brought the Zune Social aspect of Zune Cards from the Zune music experience like what I had created in Silverlight and was quite popular gaining over 330,000 downloads. You can still see what that application was like as the website for ZuneCardr for Windows Phone 7 is still online today which you can visit at zunecardr.com or check out the link in the show notes.

Universal Windows Platform

Windows 8 and Windows Phone 8 introduced the idea of modern apps that used XAML with WinRT which provided modern APIs to target either platform along with both platforms with Windows 8.1 and Windows Phone 8.1. Windows 10 and Windows 10 Mobile released in 2015 would usher in a new era for application developers using XAML with the introduction of the Universal Windows Platform. UWP would extend the work introduced previously for mobile and desktop to create a brand-new platform with new APIs to create modern applications that could run wherever Windows ran at the time which not only included desktop and mobile but also platforms such as HoloLens and Xbox.

Universal Windows Platform meant that new applications were free of the legacy of older applications and could look and feel like any other modern application created for Windows 10. UWP delivered a single platform for developers that took advantage of XAML to create rich, modern and dynamic user interfaces with the latest version of the Modern Design Language used by Windows 10. However, applications would take advantage .NET Native which was not the same as .NET Framework along with differences in functionality so made it difficult for existing applications to be ported from Windows Presentation Foundation or Silverlight, plus legacy Win32 applications required functionality that was not present in UWP which made adoption even more difficult.

Universal Windows Platform brought more platforms to developers using XAML than ever before however Windows 10 Mobile which had tried to succeed where Windows Phone had failed also failed and by 2020 Microsoft's mobile platform and hardware dream was over. However, Universal Windows Platform continued to evolve and the idea of separating the user interface controls from releases of Windows was introduced with the first version of WinUI, which meant that newer controls used in applications from newer versions of Windows 10 could target older versions of Windows 10. However, the desire to bring Win32 applications to the modern era along with the decision to focus more on the desktop spelt the end of the Universal Windows Platform era and the idea of bringing Universal Windows Platform and Win32 together was proposed.

I supported Universal Windows Platform more than any previous platform I had ever supported, including creating one hundred and twenty-eight tutorials showing off the power of Universal Windows Platform and writing my own applications on the Windows store. So it was disappointing to find out Microsoft was ending support for Universal Windows Platform, I was lucky enough to have some warning compared to others so was able to stop my plan to re-write all those tutorials for my new website so could switch to the next platform to be supported instead, but you can still check out those tutorials at tutorialr.com/tutorials/uwp or check out the link in the show notes.

Windows App SDK

Universal Windows Platform was over, and the future would be the result of something codenamed Project Reunion, which would bring together the idea of Universal Windows Platform to create modern apps and bring the legacy of Win32 development up to date and this would become Windows App SDK. Windows App SDK would allow developers to target Windows 11 when it was released in 2021 but could also target later versions of Windows 10 to create applications using XAML with WinUI 3 which was first introduced with Universal Windows Platform, allowing developers create modern applications using the new Fluent Design Language that could also take advantage of the new modern APIs and existing Win32 APIs along with the features of latest version of .NET.

I've been supporting Windows App SDK with my own tutorials and am in the process of writing one hundred tutorials with the first fifty released last year and the final fifty releasing this year. I have also spoke about Windows App SDK in more detail on Episode Two of the RoguePlanetoid Podcast, which you can listen to if you haven't already or check out the link in the show notes.

Conclusion

XAML or eXtensible Application Markup Language began with Windows Presentation Foundation in .NET Framework 3.0, but WPF continues to be supported in modern .NET today. XAML was also used in many platforms no longer available such as Silverlight for web, desktop and mobile with Windows Phone or for modern apps on mobile and desktop along with many more such as HoloLens and Xbox with Universal Windows Platform. XAML is also at the core of the latest applications targeting Windows 11 on desktop with Windows App SDK.

However, XAML today is not just used in Windows Presentation Foundation and Windows App SDK using modern .NET, but it is also used on other platforms including .NET MAUI from Microsoft, along with third-party platforms including Uno Platform. To find out more about those then follow or subscribe to the RoguePlanetoid Podcast where I'll be covering .NET MAUI and Uno Platform in future episodes.

Outro

Thanks for listening to the RoguePlanetoid Podcast where each episode you will find insights about Microsoft or related platforms and technology, along with so much more wherever you listen to your podcasts or at rogueplanetoid.com/podcasts for the RoguePlanetoid Podcast whether you are a beginner or an experienced professional or just interested in technology. Keep Current, Keep Coding!

RoguePlanetoid Podcast is a production of cluarantonn.com

Hosted, Written, Produced and Edited by Peter Bull

Music based on Like a Tiger by Jo Wandrini

Production Company Name by Granny Robertson