lepoco / wpfui

WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.
https://wpfui.lepo.co
MIT License
7.63k stars 744 forks source link

NavigationView cant set BackButtonVisible in defual xaml when PaneDisplayMode is LeftFluent #1215

Open MatinxHT opened 2 months ago

MatinxHT commented 2 months ago

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

MatinxHT commented 2 months ago

Maybe the same problom can reproduce in WPF UI Gallery

We will see that title show in wrong place .bu due to AutoSuggestBoxthe NavigationMeunItem seens get a right vertical coordinates image

Moy838840554 commented 2 months ago

remove TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}"

MatinxHT commented 2 months ago

remove TitleBar="{Binding ElementName=TitleBar, Mode=OneWay}"

It doesn't work and even worse (〒︿〒)

TitleBarmake NavigationView beauty

image

Moy838840554 commented 2 months ago
<Grid>
  <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
    <ui:TitleBar Grid.Row="0" />
    <ui:NavigationView Grid.Row="1"/>
</Grid>
MatinxHT commented 2 months ago
<Grid>
  <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
    <ui:TitleBar Grid.Row="0" />
    <ui:NavigationView Grid.Row="1"/>
</Grid>

Oh that's a nice trick,thanks image But the BcakButton still cant show up automaticlly ,so I still need to chang its property.

Dian-Jiao commented 1 month ago

Could you please reopen this issue? I think this bug should be fixed. Thanks!

MatinxHT commented 1 month ago

Could you please reopen this issue? I think this bug should be fixed. Thanks!

Yap..As a perfectionist, I think this is a bug that can be fixed in the UI framework.