unoplatform / uno

Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported.
https://platform.uno
Apache License 2.0
8.76k stars 705 forks source link

[WPF] `ScrollViewer` incorrectly determining height of window #7695

Open bstrother1 opened 2 years ago

bstrother1 commented 2 years ago

Current behavior

Current Behavior: Scrollviewer wrapped around a User control with ReactiveUI doesn't correctly determine the UserControl length and allows scrolling when no scrolling should be. Does not occur with UWP build. UnoIncorrectHeight.zip

Expected behavior

Scrollviewer correctly determines window parameters.

In UWP this works correctly but in WPF the ScrollView is unable to determine height of nested usercontrol.

How to reproduce it (as minimally and precisely as possible)

Steps To Reproduce: 1) Have MVVM build 2) Use ReactiveUI 3) Wrap Grid with Scrollview

Workaround

No response

Works on UWP/WinUI

Yes

Environment

WPF

NuGet package version(s)

<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Splat.Microsoft.Extensions.DependencyInjection" Version="14.1.17" />
<PackageReference Include="Uno.UI.Skia.Wpf" Version="4.0.11" />
<PackageReference Include="Uno.UI.RemoteControl" Version="4.0.11" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="4.0.11" />
<PackageReference Include="ReactiveUI.Fody" Version="17.1.9" />
<PackageReference Include="ReactiveUI.Uno" Version="17.1.9" />

Affected platforms

No response

IDE

Visual Studio 2022

IDE version

17.0.4

Relevant plugins

No response

Anything else we need to know?

No response

agneszitte commented 2 years ago

We will need to check if this issue is happening with something else than the nested ReactiveUI RoutedViewHost, or if it's really specific to that only.

XAML extract from the attached sample project:

    <ScrollViewer>
        <Grid>
            <StackPanel VerticalAlignment="Top" Orientation="Horizontal">
                <reactiveUi:RoutedViewHost Router="{x:Bind ViewModel.Router, Mode=OneWay}" />
            </StackPanel>
            <Button Content="Go next" Command="{x:Bind ViewModel.GoNext, Mode=OneWay}" />
    </Grid>
    </ScrollViewer>
jeromelaban commented 2 years ago

We may need to revalidate based on https://github.com/unoplatform/uno/pull/7938

MartinZikmund commented 2 years ago

@bstrother1 Can you please check if this problem is still there in the latest dev NuGet package?

bstrother1 commented 2 years ago

Sorry for the late reply. The moment I get the opportunity I will and report the results.

bstrother1 commented 2 years ago

@bstrother1 Can you please check if this problem is still there in the latest dev NuGet package?

Upgraded and still experiencing this on 4.2.0-dev.673 and Toolkit 7.1.11.

bstrother1 commented 2 years ago

@bstrother1 Can you please check if this problem is still there in the latest dev NuGet package?

fail: Windows.UI.Xaml.Controls.ScrollContentPresenter[0] The member float ZoomFactor is not implemented in Uno.

Not sure if this is the issue but it throws when accidentally scrolling.