This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Fix Frame IsClippedToBounds issue (#11129)
* Fixed issue clipping the Frame content on iOS * Updated sample * Updated iOS FrameRenderer * Added sample to test issue 11291
- Loading branch information
1 parent
3f6ae8f
commit 816e1c8
Showing
5 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11120.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,101 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ContentPage | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Xamarin.Forms.Controls.Issues.Issue11120" | ||
Title="Issue 11120"> | ||
<Grid | ||
BackgroundColor="Wheat" | ||
RowSpacing="0"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<Label | ||
Grid.Row="0" | ||
Padding="12" | ||
BackgroundColor="Black" | ||
TextColor="White" | ||
Text="If the corners of the buttons clip to bounds, the test has passed."/> | ||
<Grid | ||
Grid.Row="1"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<Frame | ||
Padding="0" | ||
CornerRadius="{Binding Source={x:Reference CornerRadiusSlider},Path=Value}" | ||
IsClippedToBounds="{Binding Source={x:Reference IsClippedToBoundsCheckBox},Path=IsChecked}"> | ||
<Frame.Resources> | ||
<ResourceDictionary> | ||
|
||
<Style | ||
TargetType="Frame"> | ||
<Setter Property="BackgroundColor" Value="WhiteSmoke"/> | ||
<Setter Property="HasShadow" Value="True"/> | ||
<Setter Property="HorizontalOptions" Value="FillAndExpand"/> | ||
<Setter Property="Margin" Value="40"/> | ||
<Setter Property="Padding" Value="20"/> | ||
<Setter Property="VerticalOptions" Value="Center"/> | ||
</Style> | ||
|
||
</ResourceDictionary> | ||
</Frame.Resources> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="50" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
<Label | ||
FontSize="Subtitle" | ||
HorizontalOptions="Center" | ||
HorizontalTextAlignment="Center" | ||
Text="..." | ||
VerticalOptions="Center"/> | ||
<Grid | ||
Grid.Row="1" | ||
ColumnSpacing="0"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="50"/> | ||
</Grid.RowDefinitions> | ||
<Button | ||
BackgroundColor="Blue" | ||
TextColor="White" | ||
CornerRadius="0" | ||
Grid.Column="1" | ||
Text="YES"/> | ||
<Button | ||
BackgroundColor="Gray" | ||
TextColor="White" | ||
CornerRadius="0" | ||
Text="NO"/> | ||
</Grid> | ||
</Grid> | ||
</Frame> | ||
<StackLayout | ||
Grid.Row="1"> | ||
<StackLayout | ||
Orientation="Horizontal" | ||
VerticalOptions="Start" | ||
Padding="12 , 0"> | ||
<CheckBox | ||
x:Name="IsClippedToBoundsCheckBox" | ||
VerticalOptions="Center" | ||
IsChecked="True"/> | ||
<Label | ||
VerticalOptions="Center" | ||
Text="IsClippedToBounds"/> | ||
</StackLayout> | ||
<Label | ||
Text="CornerRadius" | ||
Margin="12, 0"/> | ||
<Slider | ||
x:Name="CornerRadiusSlider" | ||
Minimum="0" | ||
Maximum="48" | ||
Value="12"/> | ||
</StackLayout> | ||
</Grid> | ||
</Grid> | ||
</ContentPage> |
27 changes: 27 additions & 0 deletions
27
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11120.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,27 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.Frame)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11120, "[Bug] IsClippedToBounds iOS not work", PlatformAffected.iOS)] | ||
public partial class Issue11120 : ContentPage | ||
{ | ||
public Issue11120() | ||
{ | ||
#if APP | ||
InitializeComponent(); | ||
#endif | ||
|
||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11291.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,63 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.Frame)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11291, | ||
"[Bug] IsClippedToBounds not clipping Image when inside a Frame", | ||
PlatformAffected.iOS)] | ||
public class Issue11291 : TestContentPage | ||
{ | ||
public Issue11291() | ||
{ | ||
|
||
} | ||
|
||
protected override void Init() | ||
{ | ||
Title = "Issue 11291"; | ||
|
||
var layout = new StackLayout(); | ||
|
||
var instructions = new Label | ||
{ | ||
Padding = 12, | ||
BackgroundColor = Color.Black, | ||
TextColor = Color.White, | ||
Text = "If the image clips with the border of the Frame, the test has passed." | ||
}; | ||
|
||
var frame = new Frame | ||
{ | ||
IsClippedToBounds=true, | ||
BorderColor = Color.Black, | ||
Padding = 0, | ||
CornerRadius = 24, | ||
Margin = 12 | ||
}; | ||
|
||
var image = new Image | ||
{ | ||
Aspect = Aspect.AspectFill, | ||
Source = "oasis.jpg" | ||
}; | ||
|
||
frame.Content = image; | ||
|
||
layout.Children.Add(instructions); | ||
layout.Children.Add(frame); | ||
|
||
Content = layout; | ||
} | ||
} | ||
} |
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