-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect MauiCALayer being rendered offscreen (#23648)
- Loading branch information
1 parent
307941e
commit a5a3e1e
Showing
3 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/Controls/tests/TestCases.HostApp/Issues/Issue23070.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,68 @@ | ||
<?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.Issue23070" | ||
Title="Issue23070"> | ||
<ContentPage.Resources> | ||
<Color x:Key="Primary">#512BD4</Color> | ||
<Color x:Key="PrimaryDark">#ac99ea</Color> | ||
<Color x:Key="Secondary">#DFD8F7</Color> | ||
<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}"/> | ||
|
||
<DataTemplate x:Key="T0"> | ||
<Border | ||
StrokeShape="{RoundRectangle CornerRadius=20}"> | ||
<Border.Background> | ||
<LinearGradientBrush> | ||
<GradientStop Offset="0" Color="{StaticResource PrimaryDark}" /> | ||
<GradientStop Offset="1.0" Color="{StaticResource Secondary}" /> | ||
</LinearGradientBrush> | ||
</Border.Background> | ||
<Label | ||
FontAttributes="Bold" | ||
FontSize="20" | ||
HorizontalOptions="Center" | ||
Text="Hello" | ||
VerticalOptions="Center" /> | ||
<Border.Shadow> | ||
<Shadow | ||
Brush="{StaticResource PrimaryBrush}" | ||
Opacity="0.3" | ||
Radius="6" | ||
Offset="0, 3" /> | ||
</Border.Shadow> | ||
</Border> | ||
</DataTemplate> | ||
<DataTemplate x:Key="T1"> | ||
<Border | ||
StrokeShape="{RoundRectangle CornerRadius=20}"> | ||
<Border.Background> | ||
<LinearGradientBrush> | ||
<GradientStop Offset="0" Color="{StaticResource Primary}" /> | ||
<GradientStop Offset="1.0" Color="{StaticResource Secondary}" /> | ||
</LinearGradientBrush> | ||
</Border.Background> | ||
<Border.Shadow> | ||
<Shadow | ||
Brush="{StaticResource PrimaryBrush}" | ||
Opacity="0.3" | ||
Radius="6" | ||
Offset="0, 3" /> | ||
</Border.Shadow> | ||
<Label | ||
FontAttributes="Bold" | ||
FontSize="20" | ||
HorizontalOptions="Center" | ||
Text="Hello" | ||
TextColor="White" | ||
VerticalOptions="Center" /> | ||
</Border> | ||
</DataTemplate> | ||
</ContentPage.Resources> | ||
|
||
<Grid x:Name="TheGrid" Padding="24" RowDefinitions="*,40"> | ||
<Button x:Name="TheButton" Clicked="ButtonClicked" Text="Tap Me" BackgroundColor="LightGreen" /> | ||
|
||
|
||
</Grid> | ||
</ContentPage> |
41 changes: 41 additions & 0 deletions
41
src/Controls/tests/TestCases.HostApp/Issues/Issue23070.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,41 @@ | ||
using System; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
|
||
namespace Maui.Controls.Sample.Issues; | ||
|
||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, 23070, "[iOS] Border redraws with 1 frame lag", PlatformAffected.iOS)] | ||
|
||
public partial class Issue23070 : ContentPage | ||
{ | ||
int t = 0; | ||
|
||
public Issue23070() | ||
{ | ||
InitializeComponent(); | ||
var template = (DataTemplate)Resources[$"T0"]; | ||
TheGrid.Add((View)template.CreateContent(), 0, 1); | ||
} | ||
|
||
private async void ButtonClicked(object sender, EventArgs e) | ||
{ | ||
TheButton.IsEnabled = false; | ||
|
||
TheGrid.RemoveAt(1); | ||
t = (t + 1) % 2; | ||
var template = (DataTemplate)Resources[$"T{t}"]; | ||
var content = (View)template.CreateContent(); | ||
content.IsVisible = false; | ||
TheGrid.Add(content, 0, 1); | ||
await Task.Delay(1000); | ||
content.IsVisible = true; | ||
await Task.Delay(1000); | ||
content.IsVisible = false; | ||
await Task.Delay(1000); | ||
content.IsVisible = true; | ||
|
||
TheButton.IsEnabled = true; | ||
} | ||
} |
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