-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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/Catalyst] Correctly render ContentPage brushes background #11721
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8b04a8a
Added samples
jsuarezruiz bf70419
Fix the bug
jsuarezruiz 5cf46b5
Added device tests
jsuarezruiz 60c17b4
Merge branch 'main' into fix-11714
jsuarezruiz 855885f
Merge branch 'main' into fix-11714
jsuarezruiz a44461d
Removed unnecessary loop
jsuarezruiz 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
24 changes: 24 additions & 0 deletions
24
...samples/Controls.Sample/Pages/Core/ContentPageGalleries/ContentPageBackgroundGallery.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,24 @@ | ||
<views:BasePage | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Pages.ContentPageBackgroundGallery" | ||
xmlns:views="clr-namespace:Maui.Controls.Sample.Pages.Base" | ||
Title="ContentPage Background"> | ||
<ContentPage.Background> | ||
<!-- StartPoint defaults to (0,0) --> | ||
<LinearGradientBrush EndPoint="1,0"> | ||
<GradientStop Color="Yellow" | ||
Offset="0.1" /> | ||
<GradientStop Color="Green" | ||
Offset="1.0" /> | ||
</LinearGradientBrush> | ||
</ContentPage.Background> | ||
<views:BasePage.Content> | ||
<StackLayout> | ||
<Label | ||
Text="ContentPage" | ||
VerticalOptions="Center" | ||
HorizontalOptions="Center" /> | ||
</StackLayout> | ||
</views:BasePage.Content> | ||
</views:BasePage> |
10 changes: 10 additions & 0 deletions
10
...ples/Controls.Sample/Pages/Core/ContentPageGalleries/ContentPageBackgroundGallery.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,10 @@ | ||
namespace Maui.Controls.Sample.Pages | ||
{ | ||
public partial class ContentPageBackgroundGallery | ||
{ | ||
public ContentPageBackgroundGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
...Sample/Pages/Core/ContentPageGallery.xaml → ...es/ContentPageBackgroundImageGallery.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,16 +1,16 @@ | ||
<views:BasePage | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Pages.ContentPageGallery" | ||
x:Class="Maui.Controls.Sample.Pages.ContentPageBackgroundImageGallery" | ||
xmlns:views="clr-namespace:Maui.Controls.Sample.Pages.Base" | ||
Title="ContentPage Gallery" | ||
Title="ContentPage BackgroundImage" | ||
BackgroundImageSource="oasis.jpg"> | ||
<views:BasePage.Content> | ||
<StackLayout> | ||
<Label | ||
Text="ContentPage" | ||
VerticalOptions="Center" | ||
HorizontalOptions="Center" /> | ||
Text="ContentPage" | ||
VerticalOptions="Center" | ||
HorizontalOptions="Center" /> | ||
</StackLayout> | ||
</views:BasePage.Content> | ||
</views:BasePage> |
10 changes: 10 additions & 0 deletions
10
...Controls.Sample/Pages/Core/ContentPageGalleries/ContentPageBackgroundImageGallery.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,10 @@ | ||
namespace Maui.Controls.Sample.Pages | ||
{ | ||
public partial class ContentPageBackgroundImageGallery | ||
{ | ||
public ContentPageBackgroundImageGallery() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Controls/samples/Controls.Sample/Pages/Core/ContentPageGalleries/ContentPageGallery.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,33 @@ | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Internals; | ||
|
||
namespace Maui.Controls.Sample.Pages | ||
{ | ||
[Preserve(AllMembers = true)] | ||
public class ContentPageGallery : ContentPage | ||
{ | ||
public ContentPageGallery() | ||
{ | ||
var descriptionLabel = | ||
new Label { Text = "ContentPage Galleries", Margin = new Thickness(2, 2, 2, 2) }; | ||
|
||
Title = "ContentPage Galleries"; | ||
|
||
Content = new ScrollView | ||
{ | ||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
descriptionLabel, | ||
GalleryBuilder.NavButton("ContentPage BackgroundImage", () => | ||
new ContentPageBackgroundImageGallery(), Navigation), | ||
GalleryBuilder.NavButton("ContentPage Background", () => | ||
new ContentPageBackgroundGallery(), Navigation), | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
} |
10 changes: 0 additions & 10 deletions
10
src/Controls/samples/Controls.Sample/Pages/Core/ContentPageGallery.xaml.cs
This file was deleted.
Oops, something went wrong.
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
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.
Not in 100% of the cases we will have the background layer as a sublayer of the main one. The main change is here, use recursion to get the background layer.