What’s new in the .NET MAUI Community Toolkit
November has been a busy time for the .NET MAUI Community toolkit with multiple releases featuring a ton of amazing new features (not to mention a long list of bug fixes). The latest releases have new Views, Layouts, Tizen support, .NET 7 support and so much more. This post will get you up to speed on all the new features.
What is the .NET Community Toolkit?
For those not familiar with the .NET MAUI Community Toolkit, it is a community-created library that contains Extensions, Advanced UI/UX Controls, Converters, and Behaviors to help make your life as a .NET MAUI developer easier. It is free and open source and created for .NET MAUI Developers by .NET MAUI developers.
Let’s dive into some of the big new features in the latest .NET MAUI Community Toolkit releases.
Expander view is a container control that provides a way to expand and collapse visual content when tapping a header. The control comprises of two sections, the header and content. The content is shown or hidden by tapping the
Expander.Header or by setting the
IsExpanded bindable property.
<toolkit:Expander> <toolkit:Expander.Header> <Label Text="Simple Expander (Tap Me)" FontSize="16" FontAttributes="Bold"/> </toolkit:Expander.Header> <toolkit:Expander.Content BackgroundColor="LightGray"> <VerticalStackLayout> <Label Text="Item 1"/> <Label Text="Item 2"/> </VerticalStackLayout> </toolkit:Expander.Content> </toolkit:Expander>
The DockLayout is a layout where views can be docked to the sides of the layout container. This makes it a great choice in many situations, where you want to divide the screen into specific areas.
DockLayout can be created in XAML like this:
<toolkit:DockLayout> <Button toolkit:DockLayout.DockPosition="Top" Text="Top" HeightRequest="50" /> <Button toolkit:DockLayout.DockPosition="Bottom" Text="Bottom" HeightRequest="70" /> <Button toolkit:DockLayout.DockPosition="Left" Text="Left" WidthRequest="80" /> <Button toolkit:DockLayout.DockPosition="Right" Text="Right" WidthRequest="90" /> <Button Text="Center" /> </toolkit:DockLayout>
StateContainer makes it super easy to dynamically display content based on the state of your application. Examples range from creating loading views to an overlay on the screen, or on a subsection of the screen. Empty state views can be created for when there’s no data to display, and error state views can be displayed when an error occurs.
In a massive contribution by the Samsung team there is now Tizen support for the .NET MAUI Community Toolkit. This brings the .NET MAUI Community toolkit to millions of Samsung TVs, phones, and other devices running Tizen.
.NET 7 Support
We also pushed out a release of .NET MAUI Community Toolkit built on .NET 7, which means those of you who want to enjoy all the great benefits of .NET 7 can do so with the .NET MAUI Community Toolkit.
In addition to the .NET MAUI Community Toolkit we also have the MAUI.Markup Toolkit which is a collection of Fluent C# Extension Methods that allows developers to architect their apps using MVVM, Bindings, Resource Dictionaries, etc. in C# without having to work in XAML.
The MAUI.Markup Toolkit has been updated to add C# extension methods for App Themeing and ITextAlignment. In fact, using source generators, Maui.Markup auto-generates extension methods for every ITextAlignment control, even if you create your own custom control! We also gave MAUI.Markup the .NET 7 treatment as well.
Those of you looking at our releases on Nuget may have noticed that there are multiple releases of the .NET MAUI Community toolkit that happened in quick succession. It is worth giving an overview of the different versions:
- Version 1.4.0 – adds Expander, DockLayout & StateContainer (and of course a lot of bugfixes!) – Release Notes
- Version 2.0.0 – adds full Tizen support for all of out features, including the changes from v1.4.0 – Release Notes
- Version 3.0.0 – everything from v1.4.0 and v2.0.0 but is built against .NET 7 – Release Notes
With this versioning strategy we aim to empower as many developers as possible: everyone on .NET 6 can get all the features we’ve merged so far, including Tizen support using v2.0.0. For those using .NET 7 you can get all the features using v3.0.0.
Importantly, going forward, .NET 7 will be the target for the amazing new features of .NET MAUI Community Toolkit!
If you want to learn more about the .NET MAUI Community toolkit you can check out this great overview video from .NET Conf 2022 where Gerald Versluis walks through the history of the Community Toolkit(s), what you can do with it today and how to get started!
Of course, you can find all source code and our sample app in our GitHub repo and check out our official documentation.
Finally, a massive thank you to all the contributors! It really is a community effort powered by your efforts. If you would like to contribute, feel free to open issues or let us know about your experience!
We hope you enjoy the latest releases of .NET MAUI Community toolkit and don’t forget you can join us live on the 1st Thursday of each month @ 1200 PT, where we live-stream our standups on the .NET Foundation YouTube Channel.
Happy coding! 💻
Is that really a good idea? .NET 7 is not an LTS release and therefore many companies cannot use it for development. Companies often have policies that require LTS/stable releases of tools before they can be used because of a variety of reasons. Saying that the Toolkit only works with .NET 7 going forward seems like you are basically putting a paywall up to those who will not/cannot update.
Why doesn’t the Toolkit multi target to .NET 6/7 like many other libraries. This has been and continues to be the recommended approach for libraries that need to support newer platforms while not leaving behind existing users. Entity Framework, for example, supports both with its latest release. I get there is extra work involved in building/testing/etc but if it is so difficult to do then perhaps MS shouldn’t be recommending other companies do it if they themselves find it too much effort…
I think situation is different in .NET7 mobile. Mobile dotnet wold is not yet mature and can’t be compared to Entity, WPF, ASP et…
Net7 mobile ecosystem could be considered as (so, so) beta, net6 mobile was something like early alpha. I expect it to be usable (hopefully) for real world apps in following year. Beside numerous bugs and problems with tools (Try to create, build and deploy catalyst app in VS for Mac, but also iOS are problematic), many Nugets are missing, not recompiled for dotnet mobile, especially from MS. But the situation is improving.
I don’t use MAUI/X.Forms, only Xamarin.Native for mobile development, but it’s based on the same technology. I still look forward for mobile dotnet development, I think it’s the best way for most of mobile apps, but we should face the facts.
While I agree with the mobile side, MAUI also targets Windows and uses the latest Windows UI tech. So .NET 6 support would be desirable on Windows even if it didn’t work for mobile but that is what multi-targeting is for so MAUI could target .NET 6/7 of Windows and .NET 7 only for other platforms, if necessary.
LTS are important on server applications
After all, support for running Android emulators from within a virtual machine, like VMware Workstation, is still missing. Eventually, the Android emulator could utilize WSL2 instead of providing their own VM. This change would be an option to establish transition from a non-working debugging experience to a successful debugging experience.
Great to see docklayout being introduced. One more building block for MDI! (Im mostly desktop dev) Although i dont think you can create functional multiple document interface just yet without doing deep dive into platform specific code (some sort of sampling window order API that works during dragging is necessary – or at least some API to reliably dock dragged element into potentially stacked window on drag release like grabbing all application owned windows under given position and ordered by depth). Statecontainer also should come handy.
Why it is not contains in default MAUI library?
The shown DockLayout example can be easily reproduced with regular Grid requiring a comparable amount of code to be written. So my question is: what is the difference between DockLayout and regular Grid? Does the performance of DockLayoutManager any better than Grid’s one?