lepoco / lepoco/wpfui

The active triggers in NavigationView are not displayed correctly

Open
#1,059 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
 I need to use it in conjunction with the Prism framework and do not require

the TargetPageType attribute. When deleting the TargetPageType attribute or leaving it null,
there will be an error in displaying the selected style

PixPin_2024-04-18_08-48-08

To Reproduce

When deleting the TargetPageType attribute or leaving it null, there will be an error in displaying the selected style。

<ui:NavigationView
    x:Name="RootNavigation"
    Grid.Row="1"
    Margin="0"
    Padding="0"
    IsBackButtonVisible="Collapsed">
    <ui:NavigationView.AutoSuggestBox>
        <ui:AutoSuggestBox x:Name="AutoSuggestBox" PlaceholderText="Search">
            <ui:AutoSuggestBox.Icon>
                <ui:IconSourceElement>
                    <ui:SymbolIconSource Symbol="Search24" />
                </ui:IconSourceElement>
            </ui:AutoSuggestBox.Icon>
        </ui:AutoSuggestBox>
    </ui:NavigationView.AutoSuggestBox>
    <ui:NavigationView.Header>
        <ui:BreadcrumbBar
            Margin="42,32,0,0"
            FontSize="28"
            FontWeight="DemiBold" />
    </ui:NavigationView.Header>
    <ui:NavigationView.MenuItems>
        <ui:NavigationViewItem Content="Dashboard" NavigationCacheMode="Enabled">
            <ui:NavigationViewItem.Icon>
                <ui:SymbolIcon Symbol="Home24" />
            </ui:NavigationViewItem.Icon>
        </ui:NavigationViewItem>
        <ui:NavigationViewItem Content="Data" NavigationCacheMode="Enabled">
            <ui:NavigationViewItem.Icon>
                <ui:SymbolIcon Symbol="DataHistogram24" />
            </ui:NavigationViewItem.Icon>
        </ui:NavigationViewItem>
    </ui:NavigationView.MenuItems>
</ui:NavigationView>
Expected behavior

This issue occurs when the NavigationViewItem does not have the TargetPageType property set. Inference and IsActive trigger xaml style incorrect

Screenshots

error:
PixPin_2024-04-18_08-48-08

success:

PixPin_2024-04-18_08-51-55

OS version

win11

.NET version

.net8

WPF-UI NuGet version

3.0.4

Additional context

No response

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.

Research direction

Start with the NavigationView and NavigationViewItem active-state styling or trigger logic, then reproduce the XAML example with TargetPageType omitted or null and compare it with the working case. Done means the selected style is displayed correctly without requiring TargetPageType; verify the behavior on .NET 8 and WPF-UI 3.0.4.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.