Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit f35ae07

Browse files
authored
Fix issue setting the initial ScrollView properties (VerticalScrollBarVisibility, etc) on WPF (#11918) fixes #11709
1 parent e4f9920 commit f35ae07

File tree

5 files changed

+85
-3
lines changed

5 files changed

+85
-3
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ContentPage
3+
xmlns="http://xamarin.com/schemas/2014/forms"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
x:Class="Xamarin.Forms.Controls.Issues.Issue11709"
6+
Title="Issue 11709">
7+
<Grid>
8+
<Grid.RowDefinitions>
9+
<RowDefinition Height="Auto" />
10+
<RowDefinition Height="*" />
11+
</Grid.RowDefinitions>
12+
<Label
13+
Padding="12"
14+
BackgroundColor="Black"
15+
TextColor="White"
16+
Text="If even being able to scroll in the ScrollView you cannot see the vertical scrollbar, the test has passed."/>
17+
<ScrollView
18+
Grid.Row="1"
19+
Orientation="Vertical"
20+
VerticalScrollBarVisibility="Never">
21+
<StackLayout>
22+
<Label
23+
FontSize="Large"
24+
Text="Item 1"/>
25+
<Label
26+
FontSize="Large"
27+
Text="Item 2"/>
28+
<Label
29+
FontSize="Large"
30+
Text="Item 3"/>
31+
<Label
32+
FontSize="Large"
33+
Text="Item 4"/>
34+
<Label
35+
FontSize="Large"
36+
Text="Item 5"/>
37+
<Label
38+
FontSize="Large"
39+
Text="Item 6"/>
40+
<Label
41+
FontSize="Large"
42+
Text="Item 7"/>
43+
<Label
44+
FontSize="Large"
45+
Text="Item 8"/>
46+
<Label
47+
FontSize="Large"
48+
Text="Item 9"/>
49+
<Label
50+
FontSize="Large"
51+
Text="Item 10"/>
52+
</StackLayout>
53+
</ScrollView>
54+
</Grid>
55+
</ContentPage>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Xamarin.Forms.CustomAttributes;
2+
using Xamarin.Forms.Internals;
3+
4+
namespace Xamarin.Forms.Controls.Issues
5+
{
6+
7+
[Preserve(AllMembers = true)]
8+
[Issue(IssueTracker.Github, 11709, "[Bug] [WPF] ScrollView - ScrollBarVisibility not respected ", PlatformAffected.WPF)]
9+
public partial class Issue11709 : ContentPage
10+
{
11+
public Issue11709()
12+
{
13+
#if APP
14+
InitializeComponent();
15+
#endif
16+
}
17+
}
18+
}

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
</Compile>
2727
<Compile Include="$(MSBuildThisFileDirectory)Issue10744.cs" />
2828
<Compile Include="$(MSBuildThisFileDirectory)Issue10909.cs" />
29+
<Compile Include="$(MSBuildThisFileDirectory)Issue11709.xaml.cs">
30+
<DependentUpon>Issue11709.xaml</DependentUpon>
31+
</Compile>
2932
<Compile Include="$(MSBuildThisFileDirectory)Issue11794.xaml.cs">
3033
<DependentUpon>Issue11794.xaml</DependentUpon>
3134
</Compile>
@@ -2283,6 +2286,10 @@
22832286
</EmbeddedResource>
22842287
</ItemGroup>
22852288
<ItemGroup>
2289+
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue11709.xaml">
2290+
<SubType>Designer</SubType>
2291+
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
2292+
</EmbeddedResource>
22862293
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue11794.xaml">
22872294
<SubType>Designer</SubType>
22882295
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>

Xamarin.Forms.Platform.WPF/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@
8383
+ ThisAssembly.Git.SemVer.Patch
8484
+ ThisAssembly.Git.SemVer.DashLabel + "+"
8585
+ ThisAssembly.Git.Commits + "-sha."
86-
+ ThisAssembly.Git.Commit)]
86+
+ ThisAssembly.Git.Commit)]

Xamarin.Forms.Platform.WPF/Renderers/ScrollViewRenderer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ protected override void OnElementChanged(ElementChangedEventArgs<ScrollView> e)
4141
Control.LayoutUpdated += NativeLayoutUpdated;
4242
}
4343

44-
// Update control property
45-
UpdateOrientation();
44+
// Update control properties
4645
LoadContent();
46+
UpdateOrientation();
47+
UpdateHorizontalScrollBarVisibility();
48+
UpdateVerticalScrollBarVisibility();
4749

4850
// Suscribe element event
4951
Controller.ScrollToRequested += OnScrollToRequested;

0 commit comments

Comments
 (0)