Xamarin.Forms and MAUI app Accessibility

Note: Some users who installed XamRight recently (about May 22 – June 7, 2023) had their trial period end early (often within a day). If this happened to you, install the latest version from the marketplace (XamRight 4.2 or later) to automatically have a new trial period start, or contact us for assistance.

There are many good reasons to consider accessibility in app development — including reaching more users and complying with governmental regulations. Microsoft has an interesting and detailed writeup with their commitment to accessibility.

When it comes to developing apps, there are many things to consider in accessibility, including high-level UX design. This post focuses on just two important areas of accessibility: content descriptions for screen readers and color contrast can be addressed by appropriate use of Xaml properties.

We include examples of warnings generated by XamRight as examples of the kinds of problems you’ll need to address, but whether or not you use XamRight, we hope these examples will help you on your journey to building accessible applications.

Supporting Screen Readers

Screen readers are a form of assistive technology that render text content to speech. They are essential to users with visual impairments who cannot rely exclusively on understanding what’s on the screen.

Xamarin.Forms and .NET MAUI have been getting better at providing reasonable default behavior for screen readers, but there are still gaps in how these defaults work with screen readers in terms of clearly presenting all of the information and options available. The app might be usable, but users who cannot see the screen will have a very poor experience.

Continue reading “Xamarin.Forms and MAUI app Accessibility”

XamRight for WPF and More License Options

With the XamRight 4.0, we excited to release support for WPF Xaml, adding it to the list of supported Xaml variants, along with Xamarin.Forms and .NET MAUI. Another much-asked-for change in this release is different licensing options at different price points. There are additional improvements we will be blogging about soon, and you can see an overview in XamRight Release Notes.

XamRight for WPF

After years of work to refactor, extend, and thoroughly test the XamRight analysis engine, we are proud to announce that XamRight now supports analyzing WPF applications in addition to Xamarin.Forms and .NET MAUI applications.

Our beta testers for XamRight for WPF included developers at Fortune 500 companies as well as companies of only a handful of developers. With that breadth of testers, we are confident in launching WPF support.

Continue reading “XamRight for WPF and More License Options”

Deploying Xamarin and Maui apps from Azure Pipelines to Google Play

Being able to deploy directly to an app store from a CI/CD pipeline is incredibly convenient, improves repeatability, and generally a good practice. But there are several pieces that have to be put in place to get it running. We’ve had to do it multiple times, so we ended up writing this up as a walkthrough for ourselves, starting almost from File > New Project. Hopefully it will be as helpful for the rest of the Xamarin/Maui community.

Most of this blog post was written using a Xamarin.Android application, but the same process works for Maui Android applications. This is focused on deployed AAB files, which is the preferred format (as of the time of writing, anyway).

This walkthrough assumes you have not published your app at all yet. If you are already building and publishing, and want to skip ahead to the part where you’re deploying directly from your DevOps Pipeline, start here.

Preparing your Android app for release

Before setting up your build pipeline, you first need to ensure that your Xamarin.Android application build properties are setup according to the necessary configurations, as well as to your application’s requirements.

First, create a custom configuration option for building your Android application to publish to the Google Play Store. Select ‘Configuration Manager’ under the build option dropdown as shown below:

Continue reading “Deploying Xamarin and Maui apps from Azure Pipelines to Google Play”

Using Xamarin.UITest with Accessible Xamarin.Forms Apps

Millions of people around the world rely on assistive technology to computers and smartphones every day. While making sure your app is usable by as many people as possible seems like a good idea anyway, accessibility is becoming the law in a growing number of circumstances.

What’s the problem?

Xamarin.Forms provides a class of AutomationProperties that map to the native accessibility API on Android, iOS and Windows. These allow you to set the description of user interface elements so that they may be read aloud by a screen reader, a common form of assistive technology that is essential for many people with visual impairments.

Testing is also important, and Xamarin.UITest is a popular solution for automating UI-driven testing scenarios. Unfortunately, both Xamarin.UITest and AutomationProperties on Android use the same native ContentDescription property, which leads to apps that are either accessible or usable with Xamarin.UITest, but not both — and this is a longstanding pain point. Support for accessibility has been improving in Xamarin.Forms, particularly in Xamarin.Forms 5.0, however open issues remain.

Just setting AutomationId can cause accessibility issues with screen readers. We encountered one such issue when we were using Android’s TalkBack screen reader with a Label like the one below:

<Label AutomationId="WelcomeLabel"
       Text="Please set a login and password for this app."/>

When this Label comes into focus, the TalkBack screen reader announces it as “WelcomeLabel”. Only the AutomationId is read by the screen reader – the crucial Text is ignored! A screen reader user would not get to hear the instructions written in the Text property, so it would be difficult for them to understand and interact with this app’s content.

Continue reading “Using Xamarin.UITest with Accessible Xamarin.Forms Apps”

Setting up your Xamarin.Forms application as a sharing target

Using Xamarin.Forms to develop mobile applications is particularly desirable because most of the UI and interaction logic for iOS and Android can be shared in a single common project. However, there are instances where code cannot be shared and has to be implemented in the platform specific projects.

One scenario that we will be discussing in this blog is setting up an application as a sharing target. There are a hand full of items that a user could share to an application from a device, for example images, text and files of various types. This post will walkthrough a sample for sharing url links from a browser to a Xamarin application, while discussing other sharing options.

Here is the documentation on how to setup an Android application as a sharing target and the sample below uses that as a reference. However, there aren’t many resources online on how to navigate back to the original application after the sharing is complete which the sample below will get into.

For Xamarin.iOS on the other hand, there are tools and templates available for setting up an iOS extension project. An IOS extension is a small standalone application for the sole purpose of displaying the sharing UI on the host application. The host application is the application that does the sharing to the target application and in the sample below the host application would be a browser application.

Below I will walk through a step by step example for setting up an Android and iOS application as a target for sharing url links.

Continue reading “Setting up your Xamarin.Forms application as a sharing target”

Xamarin.Forms BackgroundColor, TextColor, and Dark Mode

We recently undertook updating an older Xamarin.Forms app to include Dark Mode support on iOS. Newer versions of Xamarin.Forms makes it pretty easy to set up a good framework. There are some useful blog posts here and here on how to set up a framework in your app, and some very useful Microsoft documentation here.

But then we started to run into bugs, one by one. Bits of the UI just weren’t responding as we expected to Dark Mode. Thus started a journey of discovery to methodically understand how background and text colors work. Hopefully you will find this helpful in your Dark Mode efforts as well.

We’re only looking in detail at iOS, which has made Dark Mode opt-out. We’re also focusing on issues that have to do with text. There are other important issues, like images, but that’s for another post.

What does Dark Mode do?

From a high level, switching between light and dark mode simply causes some system managed colors to change. In Light Mode, the default system background is white and text is black, and vice versa for Dark Mode (not necessarily pure white and black, but close). But this is at the iOS level. Xamarin.Forms sits between your app and iOS, and Xamarin.Forms sets some colors on its own. This means that a Xamarin.Forms app will see default behavior that doesn’t exactly match the iOS platform.

Continue reading “Xamarin.Forms BackgroundColor, TextColor, and Dark Mode”

XamRight 2.30 Release for Visual Studio

We thrilled to announce the release of XamRight 2.30. This release continues to improve its powerful XAML static analysis capabilities, and introduces features to streamline your XAML development.

This release is available today for Visual Studio 2017 and 2019, and will be released for Visual Studio for Mac within a few short days.

Binding Converters

When XamRight detects that you are trying to use an undefined Binding Converter, it gives you the option to create one right there.

You can either look up converters you already have in your project, write a new one from an empty template, or import a converter from libraries of Binding Converters on GitHub.

Continue reading “XamRight 2.30 Release for Visual Studio”

XamRight 2: Visual Studio for Mac, Triggers, and more

It’s been a while since we’ve posted anything, but rest assured, we’ve been busy listening to feedback from users and improving XamRight. In the last few months, we’ve made XamRight faster, more reliable, with more accurate analysis. And that’s just the behind-the-scenes stuff. There are several visible features to talk about, and for this post we talk about two, shown in the demo below:

XamRight for Visual Studio for Mac

First of all, XamRight now runs as a Visual Studio for Mac extension, bringing all of the Binding analysis, Xaml checking, autocomplete, code editing assists, and more, that the Visual Studio (for Windows) version has. It is currently available in the Visual Studio for Mac Extension Gallery in the Beta Channel.

Continue reading “XamRight 2: Visual Studio for Mac, Triggers, and more”

Editing and Maintaining Grids with XamRight

Grids are a popular layout, giving you lots of flexibility and good layout performance. However they can get to be difficult to work with as they become increasingly complex. Take a look at this quick demo showing a few of the features of XamRight that make it easier to work with Grid layouts in Xaml.

Demonstrating XamRight features for Grids