Skip to content

Unstable order of FlyoutItems with conditional visibility #23834

Open
@formerlymisterhenson

Description

@formerlymisterhenson

Description

The order of the menu items on WinUI can differ from iOS/Android when binding IsVisible

Steps to Reproduce

  1. create app with FlyoutItems
  2. make some of them having IsVisible bound to viewmodel bool variable (set to false)
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="MauiApp1.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MauiApp1"
    Shell.FlyoutBehavior="Flyout"
    Title="MauiApp1">
    
    <FlyoutItem FlyoutDisplayOptions="AsSingleItem"
                Title="First">

        <ShellContent Title="Foo"
                      ContentTemplate="{DataTemplate local:MainPage}">
        </ShellContent>
    </FlyoutItem>
    
    <FlyoutItem FlyoutDisplayOptions="AsSingleItem"
                Title="Second">

        <ShellContent Title="Foo"
                      ContentTemplate="{DataTemplate local:MainPage}"
                      IsVisible="{Binding ShowSecondMenuItem}">
        </ShellContent>
    </FlyoutItem>
    
    <FlyoutItem FlyoutDisplayOptions="AsSingleItem"
                Title="Third">

        <ShellContent Title="Foo"
                      ContentTemplate="{DataTemplate local:MainPage}">
        </ShellContent>
    </FlyoutItem>
</Shell>
  1. invert this variable value on some point (like a button click)
        private void OnCounterClicked(object sender, EventArgs e)
        {
            WhateverModel.Instance.ShowSecondMenuItem = !WhateverModel.Instance.ShowSecondMenuItem;
        }
  1. FlyoutItem appears as last menu item
    grafik

Link to public reproduction project repository

No response

Version with bug

8.0.61 SR6.1

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

net8.0-windows10.0.19041.0

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-shellShell Navigation, Routes, Tabs, Flyoutpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/windows 🪟s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions