{"id":9727,"date":"2022-11-08T22:23:27","date_gmt":"2022-11-08T22:23:27","guid":{"rendered":"https:\/\/putridparrot.com\/blog\/?p=9727"},"modified":"2022-11-09T14:49:57","modified_gmt":"2022-11-09T14:49:57","slug":"adaptivetrigger-working-in-maui-7-x","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/adaptivetrigger-working-in-maui-7-x\/","title":{"rendered":"AdaptiveTrigger working in MAUI 7.x"},"content":{"rendered":"<p>This is just a quick update to my post <a href=\"http:\/\/putridparrot.com\/blog\/responsive-reactive-adaptive-design-in-maui\/\" rel=\"noopener\" target=\"_blank\">Responsive, Reactive, Adaptive design in MAUI<\/a>. The <em>AdaptiveTrigger<\/em> now works, so we can create adaptive UI&#8217;s like this<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;\r\n&lt;ContentPage xmlns=&quot;http:\/\/schemas.microsoft.com\/dotnet\/2021\/maui&quot;\r\n             xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2009\/xaml&quot;\r\n             x:Class=&quot;AdaptiveTriggerTest.MainPage&quot;&gt;\r\n    &lt;VisualStateManager.VisualStateGroups&gt;\r\n        &lt;VisualStateGroup x:Name=&quot;Responsive&quot;&gt;\r\n            &lt;VisualState x:Name=&quot;Large&quot;&gt;\r\n                &lt;VisualState.StateTriggers&gt;\r\n                    &lt;AdaptiveTrigger MinWindowWidth=&quot;1200&quot; \/&gt;\r\n                &lt;\/VisualState.StateTriggers&gt;\r\n                &lt;VisualState.Setters&gt;\r\n                    &lt;Setter Property=&quot;BackgroundColor&quot; Value=&quot;Blue&quot;\/&gt;\r\n\r\n                    &lt;Setter TargetName=&quot;MainLabel&quot; Property=&quot;Label.TextColor&quot; Value=&quot;Green&quot;\/&gt;\r\n                    &lt;Setter TargetName=&quot;MainLabel&quot; Property=&quot;Label.FontSize&quot; Value=&quot;128&quot;\/&gt;\r\n                &lt;\/VisualState.Setters&gt;\r\n            &lt;\/VisualState&gt;\r\n            &lt;VisualState x:Name=&quot;Default&quot;&gt;\r\n                &lt;VisualState.StateTriggers&gt;\r\n                    &lt;AdaptiveTrigger MinWindowWidth=&quot;0&quot; \/&gt;\r\n                &lt;\/VisualState.StateTriggers&gt;\r\n                &lt;VisualState.Setters&gt;\r\n                    &lt;Setter Property=&quot;BackgroundColor&quot; Value=&quot;Azure&quot;\/&gt;\r\n\r\n                    &lt;Setter TargetName=&quot;MainLabel&quot; Property=&quot;Label.TextColor&quot; Value=&quot;Red&quot;\/&gt;\r\n                    &lt;Setter TargetName=&quot;MainLabel&quot; Property=&quot;Label.FontSize&quot; Value=&quot;48&quot;\/&gt;\r\n                &lt;\/VisualState.Setters&gt;\r\n            &lt;\/VisualState&gt;\r\n        &lt;\/VisualStateGroup&gt;\r\n    &lt;\/VisualStateManager.VisualStateGroups&gt;\r\n\r\n    &lt;VerticalStackLayout\r\n            Spacing=&quot;25&quot;\r\n            Padding=&quot;30,0&quot;\r\n            VerticalOptions=&quot;Center&quot;&gt;\r\n\r\n        &lt;Label\r\n                x:Name=&quot;MainLabel&quot;\r\n                Text=&quot;Hello, World!&quot;\r\n                SemanticProperties.HeadingLevel=&quot;Level1&quot;\r\n                FontSize=&quot;32&quot;\r\n                HorizontalOptions=&quot;Center&quot; \/&gt;\r\n    &lt;\/VerticalStackLayout&gt;\r\n&lt;\/ContentPage&gt;\r\n<\/pre>\n<p>The <em>AdaptiveTrigger MinWindowWidth=&#8221;1200&#8243;<\/em> basically designates what the UI style etc. is for Window&#8217;s with a width >= 1200. The second <em>AdaptiveTrigger<\/em> is for anything smaller.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is just a quick update to my post Responsive, Reactive, Adaptive design in MAUI. The AdaptiveTrigger now works, so we can create adaptive UI&#8217;s like this &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; &lt;ContentPage xmlns=&quot;http:\/\/schemas.microsoft.com\/dotnet\/2021\/maui&quot; xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2009\/xaml&quot; x:Class=&quot;AdaptiveTriggerTest.MainPage&quot;&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name=&quot;Responsive&quot;&gt; &lt;VisualState x:Name=&quot;Large&quot;&gt; &lt;VisualState.StateTriggers&gt; &lt;AdaptiveTrigger MinWindowWidth=&quot;1200&quot; \/&gt; &lt;\/VisualState.StateTriggers&gt; &lt;VisualState.Setters&gt; &lt;Setter Property=&quot;BackgroundColor&quot; Value=&quot;Blue&quot;\/&gt; &lt;Setter TargetName=&quot;MainLabel&quot; Property=&quot;Label.TextColor&quot; Value=&quot;Green&quot;\/&gt; &lt;Setter TargetName=&quot;MainLabel&quot; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[330],"tags":[],"class_list":["post-9727","post","type-post","status-publish","format-standard","hentry","category-maui"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=9727"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9727\/revisions"}],"predecessor-version":[{"id":9729,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9727\/revisions\/9729"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=9727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=9727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=9727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}