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.

Issue with FooterMenuItems not showing Selection when manually added to xaml instead of FooterMenuItemsSource.

See original GitHub issue

Describe the bug

If you have a ObservableCollection Bound to MenuItemsSource But if you add FooterMenuItems Manually in xaml, The selections do not appear on FooterMenuItems

Steps to reproduce the bug

Steps to reproduce the behavior:

Create a Blank UWP Project. Add 'Microsoft.UI.Xaml` Package.

In MainPage.xaml add below

    <muxc:NavigationView x:Name="MyNavigationView" >
        <muxc:NavigationView.MenuItemTemplate>
            <DataTemplate>
                <muxc:NavigationViewItem Icon="Favorite" Content="{Binding Content}"/>
            </DataTemplate>
        </muxc:NavigationView.MenuItemTemplate>
        <muxc:NavigationView.FooterMenuItems>
            <muxc:NavigationViewItem Icon="Favorite" Content="Footer 1"/>
        </muxc:NavigationView.FooterMenuItems>
    </muxc:NavigationView>

In MainPage.xaml.cs add below.

    private void Page_Loaded(object sender, RoutedEventArgs e)
    {
        ObservableCollection<BindableItems> bindableItems = new ObservableCollection<BindableItems>();
        for (int i = 1; i < 5; i++)
        {
            bindableItems.Add(new BindableItems() { Content = "Header " + i.ToString() });
        }
        MyNavigationView.MenuItemsSource = bindableItems;
    }

public class BindableItems
{
    public string Content { get; set; }
}

Expected behavior

Expecting Footer Item to also show selection on left side of MenuItem

Screenshots

sc

Version Info

NuGet package version: Microsoft.UI.Xaml 2.5.0

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx) No
May 2020 Update (19041) Yes
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chingucodingcommented, Dec 15, 2020

@avknaidu The issue is being caused by the usage of the MenuItemTemplate. As a temporary workaround, you can try to use NavigationView without a datatemplate, e.g. by implementing your own “ElementFactory” and pass the processed collection to NavigationView.

1reaction
chingucodingcommented, Dec 14, 2020

I would like to look into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NavigationView.FooterMenuItems Property
Gets the list of objects to be used as navigation items in the footer menu. This documentation applies to WinUI 2 for UWP...
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