Skip to content
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

FlyoutItemIsVisible property in Shell Items is always true #24797

Closed
gonultasmf opened this issue Sep 17, 2024 · 4 comments
Closed

FlyoutItemIsVisible property in Shell Items is always true #24797

gonultasmf opened this issue Sep 17, 2024 · 4 comments
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout p/2 Work that is important, but is currently not scheduled for release s/needs-info Issue needs more info from the author s/triaged Issue has been reviewed t/bug Something isn't working
Milestone

Comments

@gonultasmf
Copy link

Description

The following definition is made within the Shell:

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="MauiApp4.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MauiApp4"
    Shell.FlyoutBehavior="Disabled"
    Title="MauiApp4">

    <ShellContent
        Title="Home"
        ContentTemplate="{DataTemplate local:MainPage}"
        FlyoutItemIsVisible="True"
        Route="MainPage" />

    <ShellContent
        Title="NewPage1"
        ContentTemplate="{DataTemplate local:NewPage1}"
        FlyoutItemIsVisible="False"
        Route="NewPage1" />

    <ShellContent
        Title="NewPage2"
        ContentTemplate="{DataTemplate local:NewPage2}"
        FlyoutItemIsVisible="False"
        Route="NewPage2" />

</Shell>

As you can see, only one of the ShellContent has its FlyoutItemIsVisible property set to true.

namespace MauiApp4
{
    public partial class AppShell : Shell
    {
        public AppShell()
        {
            InitializeComponent();

            var list = this.Items.Where(e => e.FlyoutItemIsVisible).ToList();
        }
    }
}

image

But when I debug the code; all ShellContent items have come to my list variable. When I examine it, the FlyoutItemIsVisible value of all items is True.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.90 SR9

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

Unfortunately

Relevant log output

No response

@gonultasmf gonultasmf added the t/bug Something isn't working label Sep 17, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@tj-devel709 tj-devel709 added area-controls-shell Shell Navigation, Routes, Tabs, Flyout p/2 Work that is important, but is currently not scheduled for release labels Sep 17, 2024
@jaosnz-rep jaosnz-rep added the s/triaged Issue has been reviewed label Sep 18, 2024
@tj-devel709 tj-devel709 modified the milestones: .NET 9 Planning, Backlog Sep 18, 2024
@PureWeen
Copy link
Member

I don't think this is a bug

One of the somewhat unfortunate things about Shell is that the structure in your XAML doesn't fully match the logical structure that gets created.

The Items you are filtering there are ShellItems not ShellContent

If you use Linq to SelectMany down to the ShellContent you'll notice that it is set on all of the ShellContent elements

@PureWeen PureWeen added the s/needs-info Issue needs more info from the author label Sep 25, 2024
Copy link
Contributor

Hi @gonultasmf. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@gonultasmf
Copy link
Author

I understand what you mean. This is a sad thing. When I filtered as you said, I saw that it worked correctly:

namespace MauiApp4
{
    public partial class AppShell : Shell
    {
        public AppShell()
        {
            InitializeComponent();

            var visibleShellContents = this.Items
                .SelectMany(e => e.Items)
                .SelectMany(e => e.Items)
                .Where(content => content.FlyoutItemIsVisible)
                .ToList();
        }
    }
}

Thank you for your support

@github-actions github-actions bot locked and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout p/2 Work that is important, but is currently not scheduled for release s/needs-info Issue needs more info from the author s/triaged Issue has been reviewed t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants