-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reopen #11785: FlyoutPage.IsPresented=false throws InvalidOperationException: 'Can't change IsPresented when setting Default' (default or any other value that can have a non collapsable Flyout behavior) #20088
Comments
Note the template question: |
Experimenting with |
Also the hamburger menu button is broken in its triggering states. On |
Also on |
@samhouts why tag this issue area Shell. It has nothing to do with Shell. |
This is also an issue with .Net 8 on iPads landscape as mentioned in the original issue which was opened 12/2022. Is there going to be some sort of escalation to get this fixed sooner than 1 year? |
Same here, is there no property to check if we can set this property? |
Verified this issue with Visual Studio 17.10.0 Preview 4(8.0.20&8.0.0-rc.2.9530),Can repro this issue. |
I don't think so. |
no. arguably there should be. |
And quietly moved to the backlog.... Lets hope the next move isn't another close out |
Is any progress with this issue??? |
This just keeps biting me in the ass... |
Description
There has long been issue with the
Flyout.IsPresented
property as reported before in bug #11785The original bug report is valid, but as de facto protocol, upon a new version of .NET, issues will be closed with a "s/try-latest-version" label for no apparent reason. So I will attempt to help clarify the issue so it might be fixed this time around.
As we are aware the purpose of the
IsPresented
property is to both programmatically set and get the presentation of theFlyout
.The trouble is when attempting to set
IsPresented
, if the window is in a 'split' behavior having a non collapsibleFlyout
page, you will not be allowed to set the property tofalse
. This may well make sense as this given mode demands theFlyout
always be viewable.But attempting to hide it is rejected with an
InvalidOperationException
thrown.And this is all a larger problem because (besides upon page page initialization) the value of
IsPresented
does not work in and of itself, it is not settable, and wont always reflect the current presentation state of theFlyout
. Then consequentially theIsPresentedChanged
event
may not trigger. Just as reported in bug #15767, clicking the hamburger menu button to close and open theFlyout
whenFlyoutLayoutBehavior = Popover
will not set theIsPresented
property.Beyond this malfunction, the trouble with the current design of the API is that the actual current behavior of the window is not available to the programmer, so they wont even be able to try and avoid the above issue.
The property
FlyoutLayoutBehavior
should report the actual current behavior, but it does not. The actual behavior depends on both thecurrent
FlyoutLayoutBehavior
value AND the current width of the window.So unless there is some a way to calculate this, a programmer cant even know what the actual behavior is and try to avoid the issue.
For example on
WinUI
, when the window is wide, AND theFlyoutLayoutBehavior
is eitherDefault
,SplitOnPortrait
orSplitOnLandscape
, then the behavior is 'split' (non collapsibleFlyout
andDetail
). But with these sameFlyoutLayoutBehavior
values, if the window is narrow, then the behavior is 'popover' (collapsibleFlyout
page). Therefor a programmer can't know what the behavior is at any particular time, and attempt to avoid settingIsPresented
propertyfalse
when it will cause the issues described above.So in summary these are the issues:
IsPresented
doesnt work, it isn't always settable depending on window size and may not accurately reflect the state of the Flyout Page.IsPresentedChanged
may not not trigger when the Flyout presentation changes due to the undefined conditions mentioned previously.At the very least the API should have the
FlyoutLayoutBehavior
property always report the actualFlyout
behavior. Not what the suggested behavior might be, depending on window width. And arguably there also should be a newevent
"FlyoutLayoutBehaviorChanged" added to report a user may have resized the window and caused a change of theFlyoutLayoutBehavior
value.Furthermore, the
FlyoutLayoutBehavior.Default
value needs to be documented or perhaps removed all together. At the very least it can be a valid setting value, but should never be the getting value. There is just currently no good way to know what the behavior of a "Default" is going to be, especially if its based on a variable sized window with no specifications, across multiple platforms.Hopefully this enough detail for the issue to not be simply dismissed after .NET 9 comes out and the issue hadn't been addressed
Steps to Reproduce
See bug 11785
It reports being able to use the very sample programming to reproduce
Link to public reproduction project repository
https://github.com/dotnet/maui-samples/tree/main/6.0/Navigation/FlyoutPageSample
Version with bug
8.0.3
update: Maui.Controls 8.0.61
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
8.0.3/8.0.100
Did you find any workaround?
In
WinUI
avoid settingIsPresented = false
or set theFlyoutLayoutBehavior
toPopup
before setting the property falseOf course this likely fails to provide the functionality a user wishes to have, so there's no point.
One could attempt to subscribe to the
Flyout.Focused
andFlyout.Unfocused
events, and adjust theIsPresented
property value manually, which in turn will triggerIsPresentedChanged
Though this is a poor fix as there are various reasons the
Flyout
might lose focus that doesn't include theFlyout
no longer being presented (IsPresented = false), such as the window is minimized, or a Popup takes focus away without changing the Flyout presentation state.Better the issue just gets a proper fix
Relevant log output
No response
The text was updated successfully, but these errors were encountered: