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

Expander content does not respect the given place from outside. #1180

Closed
JakobFerdinand opened this issue Jul 29, 2024 · 0 comments · Fixed by #1186
Closed

Expander content does not respect the given place from outside. #1180

JakobFerdinand opened this issue Jul 29, 2024 · 0 comments · Fixed by #1186
Labels
bug Something isn't working

Comments

@JakobFerdinand
Copy link
Contributor

JakobFerdinand commented Jul 29, 2024

Describe the bug

I´m using a ScrollViewer inside the content area of an Expander.
The available space for the expander itself is limited by a Grid.

If the Expanders content grows, the ScrollViewer should become active.
When using WPF-UI, the ScrollViewer does not get active an the content ist cut off.

To Reproduce

Here is the code to reproduce the Problem:

The MainWindow.xaml
<Window
    x:Class="ExpanderSample.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:ExpanderSample"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="MainWindow"
    Width="800"
    Height="250"
    mc:Ignorable="d">
    <Grid Margin="10">
        <Expander
            VerticalAlignment="Top"
            Header="The expander problem description"
            IsExpanded="True">
            <Expander.Content>
                <Grid>
                    <ScrollViewer>
                        <TextBlock Margin="10">
                            When I start<LineBreak />
                            to write<LineBreak />
                            some longer text<LineBreak />
                            and I use<LineBreak />
                            WPF-UI<LineBreak />
                            the Expander<LineBreak />
                            starts to<LineBreak />
                            grow<LineBreak />
                            outside<LineBreak />
                            the grid<LineBreak />
                            area.<LineBreak />
                            Then the Scrollviewer<LineBreak />
                            does not work anymore<LineBreak />
                            🥺</TextBlock>
                    </ScrollViewer>
                </Grid>
            </Expander.Content>
        </Expander>
    </Grid>
</Window>
The App.xaml
<Application
    x:Class="ExpanderSample.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:ExpanderSample"
    xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemesDictionary Theme="Light" />
                <ui:ControlsDictionary />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

To reproduce the error just copy that code into a new WPF application.
When you delete the activation of WFP-UI in the App.xamls ResourceDictionary you can test the expected behavior in plain WPF.

Expected behavior

I expect the content of the ScrollViewer to scroll like it does in plain WPF.

Screenshots

Without WPF-UI the ScrollViewer is doing it´s job:
image

With WPF-UI it´s not possible to scroll:
image

OS version

Windows 11 Enterprise
23H2

.NET version

.NET 8

WPF-UI NuGet version

3.0.4

Additional context

No response

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

Successfully merging a pull request may close this issue.

1 participant