NavigationView cant set BackButtonVisible in defual xaml when PaneDisplayMode is LeftFluent

Open
#1,215 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
desktop

Research direction

Start by reproducing the issue with the provided NavigationView XAML in MainWindow on Windows 11 using .NET 8 and WPF-UI 3.0.5, comparing LeftFluent with the C# IsBackButtonVisible workaround. Trace the NavigationView back-button initialization and verify that the button is shown automatically without setting the property in code.

Written by the indexing model from the issue text.

Description

bug
Describe the bug

when I design a new applicaton in LeftFluent PaneDisplayMode ,I found title bar 's icon & title show in wrong way.
image

But then I thinks MenuItems the bad guys.And then in Debug Mode,I set my NavigationView's Xaml property in

IsBackButtonVisible="Visible"

then The UI show Great!
image

So I keep coding ... However ,the next time I start my application in Debug mode the BackButton dont show!
I have too manul set xaml code to bring it back.Seems not about the property of IsBackButtonVisible what I set because I try Auto/Visible no one can automatically show BackButton when app start.Only one way is manually change the property of IsBackButtonVisible

And finally my way to solve this probelm by manul set property in C# code to show the BackButton

public MainWindow()
{
        InitializeComponent();
        DataContext = ViewModel;
        NavigationView.IsBackButtonVisible = NavigationViewBackButtonVisible.Visible; 
 }
To Reproduce

My NavigationView Xaml Code as follow:

<Grid Background="#1e272e">
    <ui:NavigationView
        x:Name="NavigationView"
        Margin="0,0,5,5"
        FooterMenuItemsSource="{Binding FooterMenuItems, Mode=OneWay}"
        IsBackButtonVisible="Visible"
        MenuItemsSource="{Binding MenuItems, Mode=OneWay}"
        PaneDisplayMode="LeftFluent"
        TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}"
        Transition="FadeInWithSlide">
        <ui:NavigationView.ContentOverlay>
            <Grid>
                <ui:SnackbarPresenter x:Name="SnackbarPresenter" />
            </Grid>
        </ui:NavigationView.ContentOverlay>
    </ui:NavigationView>

    <ContentPresenter x:Name="RootContentDialog" Grid.Row="0" />

    <ui:TitleBar
        x:Name="TitleBar"
        Title="SwiftKit"
        Grid.Row="0"
        CloseWindowByDoubleClickOnIcon="False">
        <ui:TitleBar.Icon>
            <ui:ImageIcon Margin="0,0,0,0" Source="pack://application:,,,/Assets/Windows_icon.png" />
        </ui:TitleBar.Icon>
    </ui:TitleBar>
</Grid>

And my C# Window Code

public partial class MainWindow : Window
{
    private readonly MainWindowViewModel ViewModel = new();
    public MainWindow()
    {
        InitializeComponent();
        DataContext = ViewModel;
        //NavigationView.IsBackButtonVisible = NavigationViewBackButtonVisible.Visible;  //Set as u need
    }
}
Expected behavior

Fix the BackButton Auto Show in LeftFluent

Screenshots

No response

OS version

Windows 11

.NET version

.Net 8

WPF-UI NuGet version

3.0.5

Additional context

No response

Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lepoco/wpfui

All issues in lepoco/wpfui

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.