-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[iOS] Allow compat iOS buttons to resize image and to respect spacing and padding #21759
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b17665e
Fix the iOS button to resize the image, respect padding, and respect …
tj-devel709 685d1ab
allow UITest - waiting for CI results
tj-devel709 f026a33
Allow the image to actually take up the whole space and fix issue wit…
tj-devel709 aa1cac7
Add UITest screenshot
tj-devel709 9d108db
remove changes to sandbox
tj-devel709 9d03f48
Merge remote-tracking branch 'origin/main' into dev/TJ/iOS18242-Compat3
tj-devel709 ac43167
Added manual testing sample
jsuarezruiz c194906
More changes in the sample
jsuarezruiz 671acca
Do not hide the text if it doesn't fit and resize if no title
tj-devel709 d8c5c31
UITests cannot share the same name
tj-devel709 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242_2.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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?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.Issue18242_2"> | ||
<ScrollView> | ||
<VerticalStackLayout | ||
Margin="0,10,0,0"> | ||
<Label | ||
Text="Image on Bottom" | ||
HorizontalTextAlignment="Center" /> | ||
<Button | ||
x:Name="BottonButton" | ||
ImageSource="dotnet_bot.png" | ||
Text="Button 1" | ||
TextColor="Black" | ||
ContentLayout="Bottom, 20" | ||
Background="LightGray"/> | ||
<BoxView | ||
HeightRequest="30"/> | ||
<Label | ||
Text="Image on Top" | ||
HorizontalTextAlignment="Center" /> | ||
<Button | ||
x:Name="TopButton" | ||
ImageSource="dotnet_bot.png" | ||
Text="Button 2" | ||
TextColor="Black" | ||
ContentLayout="Top, 20" | ||
Background="LightGray"/> | ||
<BoxView | ||
HeightRequest="30"/> | ||
<Label | ||
Text="Image on Left" | ||
HorizontalTextAlignment="Center" /> | ||
<Button | ||
x:Name="LeftButton" | ||
ImageSource="dotnet_bot.png" | ||
Text="Button 3" | ||
TextColor="Black" | ||
ContentLayout="Left, 20" | ||
Background="LightGray"/> | ||
<BoxView | ||
HeightRequest="30"/> | ||
<Label | ||
Text="Image on Right" | ||
HorizontalTextAlignment="Center" /> | ||
<Button | ||
x:Name="RightButton" | ||
ImageSource="dotnet_bot.png" | ||
Text="Button 4" | ||
TextColor="Black" | ||
ContentLayout="Right, 20" | ||
Background="LightGray"/> | ||
<BoxView | ||
HeightRequest="30"/> | ||
<Label | ||
Text="Button Padding"/> | ||
<Slider | ||
Minimum="0" | ||
Maximum="40" | ||
Value="20" | ||
ValueChanged="OnSliderPaddingValueChanged"/> | ||
<Label | ||
Text="Button Size"/> | ||
<Button | ||
Text="Update Button Size" | ||
Clicked="OnUpdateSizeButtonClicked"/> | ||
</VerticalStackLayout> | ||
</ScrollView> | ||
</ContentPage> |
38 changes: 38 additions & 0 deletions
38
src/Controls/samples/Controls.Sample.UITests/Issues/Issue18242_2.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.ManualTest, "18242_2", "Button ImageSource not Scaling as expected", PlatformAffected.iOS)] | ||
public partial class Issue18242_2 : ContentPage | ||
{ | ||
readonly Random _random; | ||
|
||
public Issue18242_2() | ||
{ | ||
InitializeComponent(); | ||
|
||
_random = new Random(); | ||
} | ||
|
||
void OnSliderPaddingValueChanged(object sender, ValueChangedEventArgs e) | ||
{ | ||
TopButton.Padding = | ||
BottonButton.Padding = | ||
LeftButton.Padding = | ||
RightButton.Padding = new Thickness(e.NewValue); | ||
} | ||
|
||
void OnUpdateSizeButtonClicked(object sender, EventArgs e) | ||
{ | ||
TopButton.HeightRequest = TopButton.WidthRequest = | ||
BottonButton.HeightRequest = BottonButton.WidthRequest = | ||
LeftButton.HeightRequest = LeftButton.WidthRequest = | ||
RightButton.HeightRequest = RightButton.WidthRequest = | ||
_random.Next(200, 300); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.