question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Responsive FlyoutBehavior

See original GitHub issue

Description

Currently there are 3 options available for the FlyoutBehavior setting: Disabled, Flyout and Locked It’d be nice to have a responsive setting which reacts to the width of the screen, Similar to how the Windows 10 & 11 settings menu has been implemented.

Example:

https://user-images.githubusercontent.com/4095127/168296567-c8edc9ec-de8c-42e7-86c1-2290072499b0.mp4

In the past the Xamarin.Forms FlyoutPage featured the following options: Default, Popover, Split, SplitOnLandscape, SplitOnPortrait. https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/flyoutpage#control-the-detail-page-layout-behavior

However,

Important The value of the FlyoutLayoutBehavior property only affects applications running on tablets or the desktop. Applications running on phones always have the Popover behavior.

Additionally I don’t believe the FlyoutLayoutBehavior was able to react to window sized changed events.

Public API Changes

<Shell x:Class="ServiceDemo.AppShell"
       xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:local="clr-namespace:ServiceDemo"
       Shell.FlyoutBehavior="Responsive">

Intended Use-Case

This feature would be useful in Windows & macOS applications as the content area can be resized. Additionally this feature is common on tablet formfactors, specifically when transitioning from landscape to portrait orientation.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
vhugogarciacommented, Jan 4, 2023

Hello @Wynadorn and @pekspro ,

I was able to implement a truly SizeChanged event by using Microsoft.Maui.Devices.DeviceDisplay, I created a post in dev.to so other can find this information as well easily: https://dev.to/vhugogarcia/responsive-flyout-in-net-maui-4ll1

I hope it helps you!

Regards, Victor

cc: @pictos

1reaction
stcmzcommented, Jan 26, 2023

The fun part is that a page’s size changes upon changing the FlyoutBehavior. So this code is actually an infinite loop.

You need to add the width of the flyout while doing the comparison to avoid infinite loop.

// define your MinPageWidth and FlyoutWidth here

if (Width <= MinPageWidth)
    shell.FlyoutBehavior = FlyoutBehavior.Flyout;
else if (Width > MinPageWidth + FlyoutWidth)
    shell.FlyoutBehavior = FlyoutBehavior.Locked;
Read more comments on GitHub >

github_iconTop Results From Across the Web

Responsive Flyout in .NET MAUI
In this post, I will show you how to implement a responsive Flyout in ... so we render the proper Flyout behavior based...
Read more >
NET MAUI Shell flyout
The FlyoutBehavior attached property can be set on Shell, FlyoutItem, ShellContent, and page objects, to override the default flyout behavior.
Read more >
Xamarin.Forms Shell flyout
A flyout is the optional root menu for a Shell application, and is accessible through an icon or by swiping from the side...
Read more >
WPF Docking - FlyoutBehavior
FlyoutBehavior. The flyout behavior controls how and when the flyout of the auto hide area is opened and closed. RadDocking comes with two...
Read more >
c# - set FlyoutLayoutBehavior to FlyoutLayoutBehavior. ...
When I am trying to add flyout behavior to FlyoutLayoutBehavior.SplitOnLandscape , I cannot find any setting for that in Shell class.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found