News

Experimental Mobile Blazor Bindings Gets New Components

Microsoft's push to apply Blazor beyond the web-dev space to mobile development is continuing, with the team announcing new components for the experimental initiative just announced last month.

Blazor, of course, is generating huge interest among Microsoft-centric developers as it uses WebAssembly to provide a compilation target for C# so it can be used to write client- and server-side code for browser-based web apps instead of JavaScript. Microsoft has been foreshadowing the future of Blazor by demonstrating how its default renderer -- currently targeting the web -- can be replaced for mobile, desktop and other targets.

Notwithstanding the widespread acrimony toward JavaScript, Microsoft says Experimental Mobile Blazor Bindings "enables developers to use familiar web programming patterns to build native mobile apps using C# and .NET for iOS and Android."

Just as on the web side, Blazor mobile projects rely heavily on UI components, and Microsoft just introduced several new ones:

  • BoxView
  • CheckBox
  • ImageButton
  • ProgressBar
  • Slider
New Components
[Click on image for larger view.] New Components (source: Microsoft)

Along with the new components, many more properties, events, and other APIs were added to existing components, which makes default components in Mobile Blazor Bindings more closely match the Xamarin.Forms UI controls. A sampling of these includes:

  • Button events were added: OnPress, OnRelease
  • Button properties were added: FontSize, ImageSource, Padding, and many more
  • Label properties were added: MaxLines, Padding, and many more
  • MenuItem property was added: IsEnabled
  • NavigableElement property was added: class

Further fleshing out the component-centric February update to Experimental Blazor Mobile Bindings is new functionality that makes it easier for developers to get from a Blazor component reference to the associated Xamarin.Forms control.

"While most UI work is done directly with the Blazor components, some UI functionality is performed by accessing the Xamarin.Forms control. For example, Xamarin.Forms controls have rich animation capabilities that can be accessed via the control itself, such as rotation, fading, scaling, and translation," said Eilon Lipton in a blog post today (Feb. 10) before detailing the three-step process to access a Xamarin.Forms element.

The second preview also fixes a bunch of bugs and includes Xamarin.Essentials in the project template. "Xamarin.Essentials provides developers with cross-platform APIs for their mobile applications," Lipton said. "With these APIs you can make cross-platform calls to get geolocation info, get device status and capabilities, access the clipboard, and much more."

The Experimental Mobile Blazor Bindings repo on GitHub says to try it out, developers need the .NET Core 3.0 or 3.1 SDK, Visual Studio or Visual Studio for Mac, and the ASP.NET and web development and Mobile development with .NET (Xamarin.Forms) workloads installed. More documentation is also available.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

Subscribe on YouTube