Open DeepWorksStudios opened 2 years ago
for now I just comment out the line in order to run the app, but it's not clear to me what impact it has.
Looks like functionality is correct as far as exception is concerned, https://github.com/dotnet/maui/blob/7efa74c205e40c9e849294eb47e6566139f80404/src/Controls/src/Core/FlyoutPage.cs#L269
Should update the demo to not have that option based on the scenario.
However, honestly we should not recommend flyoutpage and Shell should be used in all cases.
Thanks James for the guidance. I've played with the shellflyout sample and it does make more sense.
Looks like the documentation might also be incorrect, unless the current behaviour is a bug: https://docs.microsoft.com/en-us/dotnet/maui/user-interface/pages/flyoutpage
I'm honest, it's really confusing since this is an official template with no changes and if I understood correctly, it shouldn't be used? Then the question is why even provide such a template in this case
I wish I'd noticed this thread earlier. I dug into this a bit more and commented in the related #229. The problem is that IsPresented = false
appears incompatible with a split layout (FlyoutLayoutBehavior.Split
and SplitXXX
).
On the Windows platform, where FlyoutLayoutBehavior.Default
is implemented as FlyoutLayoutBehavior.Split
, the exception occurs.
On the Android platform, where FlyoutLayoutBehavior.Default
is implemented as FlyoutLayoutBehavior.Popover
, everything seems to work fine.
My workaround was to simply add FlyoutLayoutBheavior = "Popover"
to the FlyoutPage
in AppFlyout.xaml.
Then, things appear to work correctly on both platforms.
I'm still learning MAUI, but I think I finally understand the full dimension of this problem.
The line IsPresented = false
is primarily intended to dismiss a popover dialog. When using a split layout, instead of a popover layout, dismissing it does not make sense (and is not supported)...so it throws an InvalidOperationException
.
The correct way to fix this is probably to change the following line in AppFlyout.xaml.cs
:
IsPresented = false;
To only dismiss popover layouts, as follows:
if (!((IFlyoutPageController)this).ShouldShowSplitMode)
IsPresented = false;
The problem still exists today, and worse, the latest expansion makes it unbuildable unless removed the code of the FlyoutPage Sample.csproj
<ItemGroup>
<KnownRuntimePack Update="@(KnownRuntimePack)">
<LatestRuntimeFrameworkVersion Condition="'%(TargetFramework)' == 'net7.0'">6.0.4</LatestRuntimeFrameworkVersion>
</KnownRuntimePack>
<KnownFrameworkReference Update="@(KnownFrameworkReference)">
<TargetingPackVersion Condition="'%(TargetFramework)' == 'net7.0'">6.0.4</TargetingPackVersion>
<LatestRuntimeFrameworkVersion Condition="'%(TargetFramework)' == 'net7.0'">6.0.4</LatestRuntimeFrameworkVersion>
</KnownFrameworkReference>
</ItemGroup>
Any updates?
will the demos be updated correctly some day? if yes whene would that be
Description
If you selected a flyout it breaks with the error
System.InvalidOperationException: 'Can't change IsPresented when setting Default'
Exception Details as log
Steps to Reproduce
Version with bug
6.0.400 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
All Windows Versions
Did you find any workaround?
No
Relevant log output
exceptionBreak.txt