forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify iOS ScrollView (dotnet#26763)
- Loading branch information
1 parent
7a48123
commit bc24a00
Showing
19 changed files
with
403 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+3.17 KB
(100%)
src/Controls/tests/TestCases.Android.Tests/snapshots/android/NoScrollbarsTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 26629, "ScrollView resizes when content changes", PlatformAffected.All)] | ||
public class Issue26629 : ContentPage | ||
{ | ||
public Issue26629() | ||
{ | ||
var grid = new Grid | ||
{ | ||
Margin = 40, | ||
RowSpacing = 16, | ||
BackgroundColor = Colors.Beige, | ||
RowDefinitions = new RowDefinitionCollection( | ||
new RowDefinition(GridLength.Auto), | ||
new RowDefinition(GridLength.Auto), | ||
new RowDefinition(GridLength.Auto), | ||
new RowDefinition(GridLength.Star)), | ||
ColumnDefinitions = new ColumnDefinitionCollection(new ColumnDefinition(GridLength.Star)), | ||
}; | ||
var scrollView = new ScrollView { AutomationId = "TheScrollView" }; | ||
var scrollViewVsl = new VerticalStackLayout(); | ||
var button = new Button | ||
{ | ||
Text = "Add Label", | ||
AutomationId = "AddLabelButton", | ||
}; | ||
|
||
var sizeLabel = new Label | ||
{ | ||
AutomationId = "SizeLabel", | ||
}; | ||
sizeLabel.SetBinding(Label.TextProperty, new Binding(nameof(View.Height), source: scrollView)); | ||
|
||
var scrollOffsetLabel = new Label | ||
{ | ||
AutomationId = "ScrollOffsetLabel", | ||
}; | ||
scrollOffsetLabel.SetBinding(Label.TextProperty, new Binding(nameof(ScrollView.ScrollY), source: scrollView)); | ||
|
||
var i = 0; | ||
scrollView.BackgroundColor = Colors.LightBlue; | ||
scrollView.Padding = 16; | ||
scrollView.VerticalOptions = LayoutOptions.Start; | ||
scrollViewVsl.Children.Add(CreateLabel("Label0")); | ||
button.Clicked += (sender, args) => | ||
{ | ||
scrollViewVsl.Children.Add(CreateLabel($"Label{++i}")); | ||
}; | ||
|
||
scrollView.Content = scrollViewVsl; | ||
grid.Add(button, 0, 0); | ||
grid.Add(sizeLabel, 0, 1); | ||
grid.Add(scrollOffsetLabel, 0, 2); | ||
grid.Add(scrollView, 0, 3); | ||
|
||
Content = grid; | ||
} | ||
|
||
static Label CreateLabel(string automationId) | ||
{ | ||
return new Label | ||
{ | ||
Text = "Huge", | ||
FontSize = 100, | ||
BackgroundColor = Colors.SlateBlue, | ||
AutomationId = automationId, | ||
}; | ||
} | ||
} | ||
} |
64 changes: 34 additions & 30 deletions
64
src/Controls/tests/TestCases.HostApp/Issues/Issues17801.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue17801"> | ||
<ScrollView> | ||
<VerticalStackLayout | ||
Spacing="25" | ||
Padding="30,0" | ||
VerticalOptions="Center"> | ||
<Image | ||
Source="dotnet_bot.png" | ||
HeightRequest="200" | ||
HorizontalOptions="Center" /> | ||
<Label | ||
AutomationId="WaitForStubControl" | ||
Text="Hello, World!" | ||
SemanticProperties.HeadingLevel="Level1" | ||
FontSize="32" | ||
HorizontalOptions="Center" /> | ||
<Label | ||
Text="Welcome to .NET Multi-platform App UI" | ||
FontSize="18" | ||
HorizontalOptions="Center" /> | ||
<Button | ||
x:Name="CounterBtn" | ||
Text="Click me" | ||
Clicked="OnCounterClicked" | ||
HorizontalOptions="Center" /> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
</ContentPage> | ||
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue17801"> | ||
<ShellContent Title="Home"> | ||
<ContentPage> | ||
<ScrollView> | ||
<VerticalStackLayout | ||
Spacing="25" | ||
Padding="30,0" | ||
VerticalOptions="Center"> | ||
<Image | ||
Source="dotnet_bot.png" | ||
HeightRequest="200" | ||
HorizontalOptions="Center" /> | ||
<Label | ||
AutomationId="WaitForStubControl" | ||
Text="Hello, World!" | ||
SemanticProperties.HeadingLevel="Level1" | ||
FontSize="32" | ||
HorizontalOptions="Center" /> | ||
<Label | ||
Text="Welcome to .NET Multi-platform App UI" | ||
FontSize="18" | ||
HorizontalOptions="Center" /> | ||
<Button | ||
x:Name="CounterBtn" | ||
Text="Click me" | ||
Clicked="OnCounterClicked" | ||
HorizontalOptions="Center" /> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
</ContentPage> | ||
</ShellContent> | ||
</Shell> |
2 changes: 1 addition & 1 deletion
2
src/Controls/tests/TestCases.HostApp/Issues/Issues17801.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.57 KB
(100%)
src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/NoScrollbarsTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.