Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
[iOS, UWP] Background Brush issues (#14614)
Browse files Browse the repository at this point in the history
* Cannot reproduce the issue, just add a sample

* Added implicit conversion from Color to SolidColorBrush

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
  • Loading branch information
jsuarezruiz and jfversluis committed Oct 19, 2021
1 parent 1b0d8f2 commit 3dcfa50
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<local:TestContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Test 13930" xmlns:local="using:Xamarin.Forms.Controls"
x:Class="Xamarin.Forms.Controls.Issues.Issue13930">
<local:TestContentPage.Resources>
<ResourceDictionary>

<Color x:Key="CustomColor">#2B0B98</Color>

</ResourceDictionary>
</local:TestContentPage.Resources>
<StackLayout>
<Label
Padding="12"
BackgroundColor="Black"
TextColor="White"
Text="If the Entry have a background color, the test has passed."/>
<StackLayout
Padding="12">
<Entry
Placeholder="Placeholder"
Background="{StaticResource CustomColor}"/>
<Entry
Placeholder="Placeholder"
IsEnabled="False"
Background="{StaticResource CustomColor}"/>
</StackLayout>
</StackLayout>
</local:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif

namespace Xamarin.Forms.Controls.Issues
{
[Issue(IssueTracker.Github, 13930,
"[Bug] Entry Background doesn't work to set color",
PlatformAffected.iOS)]
public partial class Issue13930 : TestContentPage
{
public Issue13930()
{
#if APP
InitializeComponent();
#endif
}

protected override void Init()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8" ?>
<local:TestContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Test 14613" xmlns:local="using:Xamarin.Forms.Controls"
x:Class="Xamarin.Forms.Controls.Issues.Issue14613">
<StackLayout>
<Label
Padding="12"
BackgroundColor="Black"
TextColor="White"
Text="If Frame have a red background color in all the cases, the test has passed."/>
<StackLayout
Padding="12">
<Label
TextColor="White"
Text="Using BackgroundColor"/>
<Frame
Background="Red">
<Label
TextColor="White"
Text="Color"/>
</Frame>
<Label
Text="Using Background"/>
<Frame>
<Frame.Background>
<SolidColorBrush
Color="Red" />
</Frame.Background>
<Label
TextColor="White"
Text="SolidColorBrush"/>
</Frame>
</StackLayout>
</StackLayout>
</local:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif

namespace Xamarin.Forms.Controls.Issues
{
[Issue(IssueTracker.Github, 14613,
"[Bug] Frame Background property not working",
PlatformAffected.iOS)]
public partial class Issue14613 : TestContentPage
{
public Issue14613()
{
#if APP
InitializeComponent();
#endif
}

protected override void Init()
{
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue11795.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue14528.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue14286.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue14613.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue13930.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue11211.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue13592.xaml.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue9079.xaml.cs" />
Expand Down Expand Up @@ -2258,6 +2260,12 @@
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue14286.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue14613.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue13930.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Issue11211.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
Expand Down
4 changes: 3 additions & 1 deletion Xamarin.Forms.Core/Brush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
{
[TypeConverter(typeof(BrushTypeConverter))]
public abstract class Brush : Element
{
{
public static Brush Default
{
get { return new SolidColorBrush(Color.Default); }
}

public static implicit operator Brush(Color color) => new SolidColorBrush(color);

public abstract bool IsEmpty { get; }

public static bool IsNullOrEmpty(Brush brush)
Expand Down

0 comments on commit 3dcfa50

Please sign in to comment.