Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provides a way to remove the ScrollViewer from the NavigationView #1041

Open
SlimeNull opened this issue Apr 8, 2024 · 4 comments
Open

Provides a way to remove the ScrollViewer from the NavigationView #1041

SlimeNull opened this issue Apr 8, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@SlimeNull
Copy link

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

@SlimeNull SlimeNull added the bug Something isn't working label Apr 8, 2024
@zbellerose
Copy link

This is needed if it isn't already implemented. If someone has a workaround please let me know.

@SlimeNull
Copy link
Author

This is needed if it isn't already implemented. If someone has a workaround please let me know.

I'm now using version 2.1.0 of the WPF-UI package, and even though it's already marked as "deprecated", because the different parts of its NavigationView control are separated, I can just use its "NavigationStore" and then place the Frame control myself.

This solved my problem for the time being ...

@pomianowski
Copy link
Member

pomianowski commented Apr 14, 2024

It's not the NavigationView that has ScrollViewer, but a Page. Take a look at
https://github.com/lepoco/wpfui/blob/main/src/Wpf.Ui.Gallery/Views/Pages/DesignGuidance/IconsPage.xaml

ScrollViewer.CanContentScroll="False"

@SlimeNull
Copy link
Author

SlimeNull commented Apr 14, 2024

But, the default value of ScrollViewer.CanContentScroll seems to be "False", why the page become scrollable?

Here is the defination of ScrollViewer.CanContentScrollProperty: ScrollViewer - source.dot.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants