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
[Core] Brushes working with DynamicResource #12761
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
44ba63e
Propagate BC to Brush childrens
jsuarezruiz 640076f
Added Brush unit test to check if propagate the bc correctly
jsuarezruiz c34298a
Added another repro sample
jsuarezruiz fa9a60e
Fix the issue
jsuarezruiz d694064
Added brush parent unit test
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
36 changes: 36 additions & 0 deletions
36
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11691.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,36 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<controls:TestContentPage | ||
xmlns:controls="clr-namespace:Xamarin.Forms.Controls" | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Xamarin.Forms.Controls.Issues.Issue11691" | ||
Title="Issue 11691"> | ||
<controls:TestContentPage.Resources> | ||
<ResourceDictionary> | ||
|
||
<Color x:Key="PrimaryColor">#0099ff</Color> | ||
|
||
<SolidColorBrush x:Key="PrimaryColorBrush" Color="{DynamicResource PrimaryColor}" /> | ||
|
||
</ResourceDictionary> | ||
</controls:TestContentPage.Resources> | ||
<controls:TestContentPage.Content> | ||
<StackLayout> | ||
<Label | ||
Padding="12" | ||
BackgroundColor="Black" | ||
TextColor="White" | ||
Text="If both polygons are visible, the test has passed."/> | ||
<Label | ||
Text="Polygon with fixed color" /> | ||
<Polygon | ||
Fill="Blue" | ||
Points="10,10 100,20 150,45 70,50" /> | ||
<Label | ||
Text="Polygon with dynamic color" /> | ||
<Polygon | ||
Fill="{DynamicResource PrimaryColorBrush}" | ||
Points="10,10 100,20 150,45 70,50" /> | ||
</StackLayout> | ||
</controls:TestContentPage.Content> | ||
</controls:TestContentPage> |
33 changes: 33 additions & 0 deletions
33
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11691.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,33 @@ | ||
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.Shape)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11691, | ||
"Polygon Shape doesn't work with DynamicResource color binding", | ||
PlatformAffected.All)] | ||
public partial class Issue11691 : TestContentPage | ||
{ | ||
public Issue11691() | ||
{ | ||
#if APP | ||
InitializeComponent(); | ||
#endif | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
|
||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11911.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,32 @@ | ||
<?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.Issue11911" | ||
Title="Issue 11911"> | ||
<ContentPage.Resources> | ||
<ResourceDictionary> | ||
|
||
<Color x:Key="DynamicColor">Red</Color> | ||
|
||
</ResourceDictionary> | ||
</ContentPage.Resources> | ||
<StackLayout> | ||
<Label | ||
Padding="12" | ||
BackgroundColor="Black" | ||
TextColor="White" | ||
Text="If the gradient use Green and Red colors, the test has passed."/> | ||
<BoxView | ||
HorizontalOptions="FillAndExpand" | ||
VerticalOptions="FillAndExpand"> | ||
<BoxView.Background> | ||
<LinearGradientBrush | ||
StartPoint="0.5, 0" EndPoint="0.5, 1"> | ||
<GradientStop Color="Green" Offset="0.0" /> | ||
<GradientStop Color="{DynamicResource DynamicColor}" Offset="1.0" /> | ||
</LinearGradientBrush> | ||
</BoxView.Background> | ||
</BoxView> | ||
</StackLayout> | ||
</ContentPage> |
18 changes: 18 additions & 0 deletions
18
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11911.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,18 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
|
||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11911, "[Bug] Brushes can't use DynamicResource", PlatformAffected.All)] | ||
public partial class Issue11911 : ContentPage | ||
{ | ||
public Issue11911() | ||
{ | ||
#if APP | ||
InitializeComponent(); | ||
#endif | ||
} | ||
} | ||
} |
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
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
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.
you need some code (and unit test) to unparent Brushes