lepoco / lepoco/wpfui

Provides a way to remove the ScrollViewer from the NavigationView

Open
#1,041 8 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

In my page, there is an area, its height is adaptive, and the content is with ScrollViewer, as long as the page is limited to the frame of the NavigationView, instead of being free to get bigger, this set of layouts works, however, because NavigationView has a built-in ScrollViewer, this causes the height of my Page to no longer be limited, but to become very high, So my whole page became scrollable, but in my expectation, the only area that could be scrolled was a part of the ScrollViewer that I put in

To Reproduce
  1. Add a NavigationView to the main window.
  2. Navigate to a page with a ScrollViewer, and the ScrollViewer cannot be forced to limit height.

The layout of the page can look like this:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition MinHeight="200"/>
        <RowDefinition Height="3"/>
        <RowDefinition Height="120" MinHeight="60" MaxHeight="500"/>
    </Grid.RowDefinitions>

    <ScrollViewer Grid.Row="0">
        <ItemsControl ItemsSource="{Binding ViewModel.Messages}"/>
        <!-- When there are more messages, this should become a scrollable area -->
    </ScrollViewer>

    <GridSplitter Grid.Row="1" 
                  VerticalAlignment="Stretch" 
                  HorizontalAlignment="Stretch"/>

    <Grid>
        <TextBox />
        <Button Margin="12" 
                Content="Add message"
                Command="{Binding AddMessageCommand}"
                VerticalAlignment="Bottom" 
                HorizontalAlignment="Right" />
    </Grid>
</Grid>
Expected behavior

Allows the user to remove the ScrollViewer from the NavigationView so that the Page is non-scrollable

Screenshots

The messages area should be scrollable.
image

However, the message area does not appear as a scroll bar, and the entire page becomes scrollable
image

OS version

Windows 11 23H2 (22631.3296)

.NET version

8.0.203

WPF-UI NuGet version

3.0.3

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 at the NavigationView entry point and reproduce the provided XAML layout with its nested ScrollViewer. Determine how the built-in ScrollViewer affects page measurement and identify an appropriate way to disable or remove it. Done means the page remains non-scrollable while the messages area can scroll independently.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.