{"id":38056,"date":"2022-01-05T12:00:01","date_gmt":"2022-01-05T19:00:01","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=38056"},"modified":"2022-01-05T13:15:57","modified_gmt":"2022-01-05T20:15:57","slug":"announcing-dotnet-maui-preview-11","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-maui-preview-11\/","title":{"rendered":"Announcing .NET MAUI Preview 11"},"content":{"rendered":"<p>Today we are pleased to share .NET Multi-platform App UI (MAUI) Preview 11. In this release we have added the first batch of Fluent UI control styling, multi-window implementations, control features, and another set of iOS type alignment. These ongoing .NET MAUI previews run on the latest preview of .NET 6 and are available with the new <a href=\"https:\/\/aka.ms\/vs2022preview\" target=\"_blank\" rel=\"noopener\">Visual Studio 2022 17.1 Preview 2<\/a> on Windows <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-17-1-preview-2-is-now-available\/\" rel=\"noopener\" target=\"_blank\">shipping today<\/a>. We are on track to ship a release candidate in Q1 2022, and final release in Q2 2022.<\/p>\n<blockquote><p>The <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/net-conf-2021-recap-videos-slides-demos-and-more\/\">source for the .NET Podcast app<\/a> showcased at .NET Conf 2021 has been published, and includes Blazor, .NET MAUI, and .NET MAUI Blazor Hybrid apps.<\/p><\/blockquote>\n<p>Let&#8217;s take a deeper look at the highlights in preview 11.<\/p>\n<h2>Windows Control Styling with the Fluent Design System<\/h2>\n<p>.NET MAUI provides platform-specific design and experience by default, so your apps get the right look and feel for each platform from a single code base without any additional effort. Windows 11 introduces new UI styling with the updated <a href=\"https:\/\/www.microsoft.com\/design\/fluent\/#\/windows\">Fluent Design System<\/a>, and .NET MAUI styles all controls to use the latest. Subsequent previews will build upon this, adding more controls and support for themes. In Preview 11 you will see initial updates to:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/dotnet\/maui\/pull\/3363\">Button<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/maui\/pull\/3444\">Editor<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/maui\/pull\/3444\">Entry<\/a><\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2021\/12\/fluent_btn_entry.png\" alt=\"side by side of button and entry styling\" \/><\/p>\n<h2>Multi-window Apps<\/h2>\n<p>One of the major updates to .NET MAUI compared to Xamarin.Forms is introducing multiple windows. <code>Application.Current.Windows<\/code> holds references to all windows you have created. To open a new window, it&#8217;s as simple as:<\/p>\n<pre><code class=\"language-csharp\">var secondWindow = new Window {\r\n    Page = new MySecondPage {\r\n        \/\/ ...\r\n    }\r\n};\r\n\r\nApplication.Current.OpenWindow(secondWindow);<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2021\/12\/multi-window-macos.png\" alt=\"multiple windows for Weather app on macOS\" \/><\/p>\n<p>To try this today targeting macOS and iPadOS, add a <a href=\"https:\/\/github.com\/dotnet\/maui\/blob\/main\/src\/Controls\/samples\/Controls.Sample.SingleProject\/Platforms\/MacCatalyst\/SceneDelegate.cs\">SceneDelegate<\/a> to each respective platform folder and <a href=\"https:\/\/github.com\/dotnet\/maui\/blob\/main\/src\/Controls\/samples\/Controls.Sample.SingleProject\/Platforms\/MacCatalyst\/Info.plist#L29-L49\">update your info.plist<\/a> to enable scenes.<\/p>\n<p><div style=\"width: 1108px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-38056-1\" width=\"1108\" height=\"960\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2021\/12\/multiWin-iPadOS.mp4?_=1\" \/><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2021\/12\/multiWin-iPadOS.mp4\">https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2021\/12\/multiWin-iPadOS.mp4<\/a><\/video><\/div><\/p>\n<blockquote><p><strong>Did you know?<\/strong> This image is an iPad simulator running on Windows using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/tools\/ios-simulator\/\" target=\"_blank\" rel=\"noopener\">Remoted iOS Simulator<\/a> available when you connect to a <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/ios\/get-started\/installation\/windows\/connecting-to-mac\/\" target=\"_blank\" rel=\"noopener\">Mac build host<\/a>. Alternatively, you can debug any .NET MAUI app on a device running iPadOS (or iOS) directly from Visual Studio 2022 on Windows using <a href=\"https:\/\/docs.microsoft.com\/en-us\/xamarin\/xamarin-forms\/deploy-test\/hot-restart\" target=\"_blank\" rel=\"noopener\">Hot Restart<\/a>.<\/p><\/blockquote>\n<p>The Windows App SDK implementation of multi-window will be in an <a href=\"https:\/\/docs.microsoft.com\/windows\/apps\/windows-app-sdk\/experimental-channel\">experimental release<\/a> until release in v1.1 (see <a href=\"https:\/\/github.com\/microsoft\/microsoft-ui-xaml\/blob\/main\/docs\/roadmap.md\">roadmap<\/a>).<\/p>\n<h2>Templates and C# 10<\/h2>\n<p>Simplification is one of the main goals of .NET MAUI, to make it easier for everyone to build great apps. Going from multiple projects per platform to a single project is just one example of how we are doing that. In this release we have updated the templates using C# 10 patterns such as implicit usings and file-scoped namespaces, and added item templates for <code>ContentPage<\/code> and <code>ContentView<\/code>. Now when your project opts-in to using <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/welcome-to-csharp-10\/#implicit-usings\">ImplicitUsings<\/a> you&#8217;ll see a cleaner project file like our template&#8217;s <strong>MauiProgram.cs<\/strong>.<\/p>\n<pre><code class=\"language-csharp\">namespace Preview11;\r\n\r\npublic static class MauiProgram\r\n{\r\n    public static MauiApp CreateMauiApp()\r\n    {\r\n        var builder = MauiApp.CreateBuilder();\r\n        builder\r\n            .UseMauiApp&lt;App&gt;()\r\n            .ConfigureFonts(fonts =&gt;\r\n            {\r\n                fonts.AddFont(\"OpenSans-Regular.ttf\", \"OpenSansRegular\");\r\n            });\r\n\r\n        return builder.Build();\r\n    }\r\n}<\/code><\/pre>\n<p>So, where did all the using statements go? We use <a href=\"https:\/\/docs.microsoft.com\/dotnet\/csharp\/fundamentals\/types\/namespaces\">implicit global usings<\/a> to <a href=\"https:\/\/github.com\/dotnet\/maui\/pull\/3267\">gather them dynamically<\/a> so you don&#8217;t need to worry about it.<\/p>\n<h2>iOS, macOS, and tvOS Type Alignment<\/h2>\n<p>As part of unifying Xamarin SDKs with .NET 6, we have been working through updating our Apple related SDKs to use the native <code>nint<\/code> and <code>nuint<\/code> types in .NET 6 rather than <code>System.nint<\/code> and <code>System.nuint<\/code>. This impacts existing libraries built for iOS, macOS, and tvOS using .NET 6. To adopt this change you must recompile your code against .NET 6, and if you explicitly use the types above you should update your .NET 6 code to use the C# types.<\/p>\n<p>Read the <a href=\"https:\/\/github.com\/xamarin\/xamarin-macios\/issues\/13087\">issue for this change on GitHub<\/a> for more details.<\/p>\n<h2>New .NET MAUI Documentation<\/h2>\n<p>We have published a new batch of <a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/\" rel=\"noopener\" target=\"_blank\">documentation for .NET MAUI<\/a> including new guides for Accessibility, BlazorWebView, Border, GraphicsView, Maui.Graphics, Shadows, Splash Screen, multi-targeting, and how you can invoke platform code. <a href=\"https:\/\/docs.microsoft.com\/xamarin\/xamarin-forms\/\" rel=\"noopener\" target=\"_blank\">Xamarin.Forms documentation<\/a> is in the process of being ported and updated to .NET MAUI, and we&#8217;ll be publishing regularly from here on out. Anytime you cannot find the .NET MAUI documentation you need, check to see if there&#8217;s a Xamarin.Forms doc available since most of the concepts all apply to .NET MAUI as well. <\/p>\n<h2>Get Started Today<\/h2>\n<p>Before installing Visual Studio 2022 Preview, we highly recommend starting from a clean slate by <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/install\/remove-runtime-sdk-versions?pivots=os-windows#uninstall-net\" rel=\"noopener\" target=\"_blank\">uninstalling all .NET 6<\/a> previews and <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/install\/uninstall-visual-studio?view=vs-2022\" rel=\"noopener\" target=\"_blank\">Visual Studio 2022<\/a> previews. <\/p>\n<p>Now, install<a href=\"https:\/\/aka.ms\/vs2022preview\" target=\"_blank\" rel=\"noopener\"> Visual Studio 2022 Preview (17.1 Preview 2)<\/a> and confirm .NET MAUI (preview) is checked under the &#8220;Mobile Development with .NET workload&#8221;. If you already have 17.1 installed, then you can just perform an update from the Visual Studio installer.<\/p>\n<p>Ready? Open Visual Studio 2022 and create a new project. Search for and select .NET MAUI.<\/p>\n<p>Preview 11 <a href=\"https:\/\/github.com\/dotnet\/maui\/releases\/tag\/6.0.101-preview.11\">release notes are on GitHub<\/a> and we have captured the top changes in a <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/Migrating-from-Preview-10-to-11\">migration guide in the wiki<\/a>. For additional information about getting started with .NET MAUI, refer to our <a href=\"https:\/\/docs.microsoft.com\/dotnet\/maui\/get-started\/installation\">documentation<\/a>.<\/p>\n<h2>Feedback Welcome<\/h2>\n<p>Please let us know about your experiences using .NET MAUI to create new applications by engaging with us on GitHub at <a href=\"https:\/\/github.com\/dotnet\/maui\">dotnet\/maui<\/a>.<\/p>\n<p>For a look at what is coming in future releases, visit our <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/roadmap\">product roadmap<\/a>, and for a status of feature completeness visit our <a href=\"https:\/\/github.com\/dotnet\/maui\/wiki\/status\">status wiki<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>.NET MAUI Preview 11 continues to stabilize controls and layouts, and introduces multi-window and Fluent updates for Windows.<\/p>\n","protected":false},"author":553,"featured_media":38057,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,7233],"tags":[7239,7238,7597],"class_list":["post-38056","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-maui","tag-dotnet-6","tag-net-maui","tag-visual-studio-2022"],"acf":[],"blog_post_summary":"<p>.NET MAUI Preview 11 continues to stabilize controls and layouts, and introduces multi-window and Fluent updates for Windows.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/38056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/553"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=38056"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/38056\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/38057"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=38056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=38056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=38056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}