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

Commit

Permalink
[Housekeeping] Update main branch with latest 5.0.0 changes (#14629)
Browse files Browse the repository at this point in the history
* Fix 4143: improved Span region calculation (#13348) fixes #4143 fixes #6992 fixes #11650 fixes #7655 fixes #11657 fixes #10520 fixes #4829 

* improved span region calculation on android

* Remove unused code

* Nit: clean up comments

* Wrap in ScrollView for small screen compatibility

Co-authored-by: Tim Dittmar <Tim.Dittmar@Exxeta.com>
Co-authored-by: Rachel Kang <rachel.j.kang@gmail.com>
Co-authored-by: Rachel Kang <rachelkang@microsoft.com>

* Only check for netfx when not in a wapproj (#14402) fixes #13957

* [macOS] Update Switch renderer (#14334) fixes #14313

* [macOS] Update Switch renderer #14313

* [macOS] Update Switch renderer #14313

* [Android] Fix to Issue Java.Lang.IndexOutOfBoundsException: setSpan (#12764) Fix to Issue #12762

* Update EntryRenderer.cs

Fix to Issue #12762
Java.Lang.IndexOutOfBoundsException: setSpan (nn ... nn) ends beyond length n-1

* Fix to EntryRenderer.cs

* Update EntryRenderer.cs

* Update EntryRenderer.cs

Co-authored-by: Rui Marinho <me@ruimarinho.net>

* [Android] Fix ClearButton not working when changing the ClearButtonVisibility while the Entry field is focused (#13820) Fixes #13819

Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>

* Automated dotnet-format update (#14404)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Automated dotnet-format update (#14405)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix memory leak (and some crashes) in ItemsViewController (iOS) (#14111)

* add unit test

* fix memory leak (and some crashes) in ItemsViewController (iOS)

* Update ItemsViewController.cs

Co-authored-by: Rui Marinho <me@ruimarinho.net>

* Enable ScrollTo tests for Android, UWP; implement ScrollTo with group index for Android (#13007)

* Remove inaccurate category

* Enable ScrollTo tests for Android/UWP; Implement grouped ScrollTo for Android

* Implement missing ScrollTo grouped item by index

* Exempt 3788 test from UWP

* Ignore test on UWP

Co-authored-by: Rui Marinho <me@ruimarinho.net>

* Fix type for case blueviolet (#14434)

The 'v' in this case was uppercase causing this typeconverter to reject BlueViolet as a valid color value. Fixes #AB1286706 [XVS]XLS0431: Invalid value for property 'BackgroundColor': 'BlueViolet'

* [iOS] Fix: CollectionView was not updating when it was invisible (#14384)

* [iOS] Fix: CollectionView was not updating when it was invisible

* [iOS] Fix: NSInternalInconsistencyException Reason: request for number of items in section X when there are only X sections in the collection view when NumberOfItemsInSection is invoked

* Revert "[iOS] Fix: NSInternalInconsistencyException Reason: request for number of items in section X when there are only X sections in the collection view when NumberOfItemsInSection is invoked"

This reverts commit 2343f15.

* [iOS] Fix: Prevent NumberOfItemsInSection invoking if CollectionView is hidded to avoid  "NSInternalInconsistencyException Reason: request for number of items in section X when there are only X sections"

* [iOS] Scroll locked issue using SwipeView (#12758)

* Fixed issue re-enabling the scroll

* Added repro sample

* Fixed also the swipe sensitive issue on iOS

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Fix removed shadow in Thumb setting a custom color (#13166)

* [iOS] Fix crash/closing wrong modal with FormSheet and tap outside (#14527)

* Add repro + fix

* Update Issue12300.cs

* [Core] SwipeItem Parent using SwipeView in DataTemplate (#13385)

* Added repro sample

* Fix the issue

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Fix Frame Background issue with transparent color (#14565)

* Fix broken disabled Button visual state in UWP (#14567)

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Update Device.Idiom when flipping tablet mode state (#13150)

* [Android] Fix occasional wrong touch interception in SwipeView Content  (#13732)

* Fix wrong touch interception in SwipeView Content on Android

* Updated swipe delta

* Fix Entry issue using TextColor and ClearButton in iOS < 13 (#14566)

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Fix issue using FormattedString and LineBreakMode on iOS (#14572)

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* Align BarBackground behavior between Android and iOS. (#13503)

* Automated dotnet-format update (#14570)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [Android] Update gradients based on offset changes in Frame and BoxView (#11812)

* Update gradients based on offset changes in Frame and BoxView on Android

* Updated the sample to test also the BoxView Brush offsets

* Fix NRE in ListView Command validation (#14580)

* [iOS] Fix inability to check an initially disabled RadioButton after enabling it (#14545)

* Listen for updates to IsEnabled on RadioButton to ensure that the tap gesture recogniser is added when the control is enabled

* Update Issue14544.cs

* Update test case

Co-authored-by: Gerald Versluis <gerald@verslu.is>

* Fix crash navigating in Shell (#14577)

* Androidx bumps (#14506)

* Update to Latest Android X Libraries

* - fix android forwarders

* Moar updates

Co-authored-by: Gerald Versluis <gerald@verslu.is>

* Validate issue 14433 (#14576)

* Added repro sample

* Updated sample

Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>

* [iOS] Remove usage of System.Drawing types (#14571)

* Run nightly also for 5.0.0 branch

* Automated dotnet-format update (#14581)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Ordering children while adding (#8231)

* Ordering children while adding

* Abstract OrderElement

* Re-order on runtime child addition and Tests

* Runtime addition ensures Z Index

* Stop performance measurement on return

* Update VisualElementPackager.cs

Co-authored-by: Gerald Versluis <gerald@verslu.is>
Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>

* If stroke is null avoid render a shape stroke (#14587)

* Fix broken Android platform tests (#14590)

* Automated dotnet-format update (#14595)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* [macOS] Fix RadioButton activated behaviour (#14139)

* Respond to Activated event

* Set initial control state based on element state

* Revert "Set initial control state based on element state"

This reverts commit 1bd1238.

* CollectionView RemainingItemsThreshold implementation for UWP (#14202)

* [Android] Fix building with Android stable bits (#14608)

* Set java sdk path

* Use class-parse

Co-authored-by: Braini01 <T_Dittmar@web.de>
Co-authored-by: Tim Dittmar <Tim.Dittmar@Exxeta.com>
Co-authored-by: Rachel Kang <rachel.j.kang@gmail.com>
Co-authored-by: Rachel Kang <rachelkang@microsoft.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Co-authored-by: MH Rastegari <42671084+mhrastegary77@users.noreply.github.com>
Co-authored-by: Felipe Silveira <felipe@transis.com.br>
Co-authored-by: Rui Marinho <me@ruimarinho.net>
Co-authored-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Thomas Mijieux <tmijieux@users.noreply.github.com>
Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com>
Co-authored-by: Marco Goertz <mgoertz@microsoft.com>
Co-authored-by: Kirill <rotorgames@bk.ru>
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
Co-authored-by: Lee Millward <lee.millward@gmail.com>
Co-authored-by: Gerald Versluis <gerald@verslu.is>
Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
Co-authored-by: Filip Navara <filip.navara@gmail.com>
Co-authored-by: Shanmukha Ranganath <shanmukharanganath@gmail.com>
Co-authored-by: Julio César Rocha <JunielKatarn@users.noreply.github.com>
Co-authored-by: nk221 <kirill.n@gmail.com>
  • Loading branch information
23 people committed Sep 20, 2021
1 parent 524750a commit 70e311b
Show file tree
Hide file tree
Showing 108 changed files with 2,485 additions and 252 deletions.
4 changes: 2 additions & 2 deletions .nuspec/Xamarin.Forms.Visual.Material.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
</group>

<group targetFramework="MonoAndroid10.0">
<dependency id="Xamarin.AndroidX.Lifecycle.LiveData" version="[2.2.0.4,2.3)" />
<dependency id="Xamarin.Google.Android.Material" version="[1.2.1.1,1.3)" />
<dependency id="Xamarin.AndroidX.Lifecycle.LiveData" version="[2.3.1.1,2.4)" />
<dependency id="Xamarin.Google.Android.Material" version="[1.4.0.2,1.5)" />
</group>
<group targetFramework="Xamarin.iOS10">
<dependency id="Xamarin.iOS.MaterialComponents" version="92.0.0"/>
Expand Down
18 changes: 9 additions & 9 deletions .nuspec/Xamarin.Forms.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="MonoAndroid10.0">
<dependency id="Xamarin.AndroidX.Lifecycle.LiveData" version="[2.2.0.4,2.3)" />
<dependency id="Xamarin.Google.Android.Material" version="[1.2.1.1,1.3)" />
<dependency id="Xamarin.AndroidX.Legacy.Support.V4" version="[1.0.0.7,1.1)" />
<dependency id="Xamarin.AndroidX.Browser" version="[1.3.0.5,1.4)" />
<dependency id="Xamarin.AndroidX.Lifecycle.LiveData" version="[2.3.1.1,2.4)" />
<dependency id="Xamarin.Google.Android.Material" version="[1.4.0.2,1.5)" />
<dependency id="Xamarin.AndroidX.Legacy.Support.V4" version="[1.0.0.8,1.1)" />
<dependency id="Xamarin.AndroidX.Browser" version="[1.3.0.6,1.4)" />

<!-- Because of a misspelled reference these all need to be explicitly included so the fixed version
is transitively loaded https://github.com/xamarin/AndroidX/issues/283#issuecomment-788103573 -->
<dependency id="Xamarin.AndroidX.Core" version="[1.3.2.3,1.4)" />
<dependency id="Xamarin.AndroidX.CustomView" version="[1.1.0.6,1.2)" />
<dependency id="Xamarin.AndroidX.Preference" version="[1.1.1.8,1.2)" />
<dependency id="Xamarin.AndroidX.RecyclerView" version="[1.1.0.8,1.2)" />
<dependency id="Xamarin.AndroidX.Navigation.UI" version="[2.3.2.1,2.4)" />
<dependency id="Xamarin.AndroidX.Core" version="[1.6.0.1,1.7)" />
<dependency id="Xamarin.AndroidX.CustomView" version="[1.1.0.7,1.2)" />
<dependency id="Xamarin.AndroidX.Preference" version="[1.1.1.9,1.2)" />
<dependency id="Xamarin.AndroidX.RecyclerView" version="[1.2.1.1,1.3)" />
<dependency id="Xamarin.AndroidX.Navigation.UI" version="[2.3.5.1,2.4)" />
</group>
<group targetFramework="uap10.0.14393">
<dependency id="NETStandard.Library" version="2.0.1"/>
Expand Down
4 changes: 2 additions & 2 deletions .nuspec/Xamarin.Forms.targets
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@

<Target Name="_ValidateNETFrameworkVersion"
BeforeTargets="_CheckForInvalidConfigurationAndPlatform"
Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' AND '$(TargetFrameworkVersion.Substring(1))' &lt; '4.6.1' AND '$(XFDisableFrameworkVersionValidation)' != 'True'">
Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' AND '$(TargetFrameworkVersion.Substring(1))' &lt; '4.6.1' AND '$(ProjectExt)' != '.wapproj' AND '$(XFDisableFrameworkVersionValidation)' != 'True'">
<Error Code="XF004"
Text="XF requires .NETFramework >= v4.6.1. You have '$(TargetFrameworkVersion)'" />
Text="Xamarin.Forms requires .NETFramework >= v4.6.1. You have '$(TargetFrameworkVersion)'" />
</Target>

<!-- XamlG -->
Expand Down
6 changes: 3 additions & 3 deletions DualScreen/DualScreen.Android/DualScreen.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.8" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.3.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.2" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\values\colors.xml" />
Expand Down
10 changes: 5 additions & 5 deletions EmbeddingTestBeds/Embedding.Droid/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.5" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.6" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.8" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.3.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.2" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.8" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'MonoAndroid10.0'">
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.RecyclerView" Version="1.1.0.8" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.3.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.8" />
<PackageReference Include="Xamarin.AndroidX.RecyclerView" Version="1.2.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.2" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions Xamarin.Forms.ControlGallery.Android/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.2.0.4" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.6" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.8" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.6" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.3.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.2" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.8" />
</ItemGroup>
<Import Project="Nuget.Build.targets" />
<Import Project="..\Nuget.targets" Condition="'$(FromSource)' == 'false'" />
Expand Down
10 changes: 5 additions & 5 deletions Xamarin.Forms.ControlGallery.Android/Nuget.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.5" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.2.1.1" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0.8" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.3.0.6" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.3.1.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.4.0.2" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.8" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@
</PackageReference>
<PackageReference Include="Xam.Plugin.DeviceInfo">
<Version>3.0.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.7" />
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.3.2.3" />
<PackageReference Include="Xamarin.AndroidX.CustomView" Version="1.1.0.6" />
<PackageReference Include="Xamarin.AndroidX.Preference" Version="1.1.1.8" />
<PackageReference Include="Xamarin.AndroidX.RecyclerView" Version="1.1.0.8" />
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.8" />
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.6.0.1" />
<PackageReference Include="Xamarin.AndroidX.CustomView" Version="1.1.0.7" />
<PackageReference Include="Xamarin.AndroidX.Preference" Version="1.1.1.9" />
<PackageReference Include="Xamarin.AndroidX.RecyclerView" Version="1.2.1.1" />
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="Assets\fonts\ionicons.ttf">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.CollectionView)]
[Category(UITestCategories.UwpIgnore)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
#endif
#if APP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

namespace Xamarin.Forms.Controls
{
#if UITEST
[Category(UITestCategories.CarouselView)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 11113, "[Bug][iOS] Path: TranslateTransform has no effect on iOS", PlatformAffected.iOS)]
public partial class Issue11113 : TestContentPage
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?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"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="Issue 11795"
x:Class="Xamarin.Forms.Controls.Issues.Issue11795">
<controls:TestContentPage.Resources>
<ResourceDictionary>

<LinearGradientBrush x:Key="LinearBrush" StartPoint="0, 0" EndPoint="1, 0">
<LinearGradientBrush.GradientStops>
<GradientStop Color="YellowGreen" Offset="0.1"/>
<GradientStop Color="Green" Offset="0.9"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>

<Style TargetType="Slider">
<Setter Property="MinimumTrackColor" Value="LightGray" />
<Setter Property="MaximumTrackColor" Value="Gray" />
</Style>

</ResourceDictionary>
</controls:TestContentPage.Resources>
<StackLayout>
<Label
Padding="12"
BackgroundColor="Black"
TextColor="White"
Text="Modify the Brush Offset values. If you modify the gradient, the test has passed."/>
<Grid>
<!-- EXPLORER -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0"
Margin="12, 0"
Padding="12">
<Label
Text="Color BoxView"
FontSize="Micro"/>
<BoxView
x:Name="SolidBoxView"
HeightRequest="60"
WidthRequest="120"
CornerRadius="12"
BackgroundColor="Red"/>
<Label
Text="Gradient BoxView"
FontSize="Micro"/>
<BoxView
x:Name="GradientBoxView"
HeightRequest="60"
WidthRequest="120"
CornerRadius="12"
Background="{StaticResource LinearBrush}"/>
<Label
Text="Color Frame"
FontSize="Micro"/>
<Frame
x:Name="SolidFrame"
HasShadow="True"
HeightRequest="60"
WidthRequest="120"
CornerRadius="12"
Padding="6"
BackgroundColor="Red">
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
TextColor="White"
Text="Color"/>
</Grid>
</Frame>
<Label
Text="Gradient Frame"
FontSize="Micro"/>
<Frame
x:Name="GradientFrame"
HasShadow="True"
HeightRequest="60"
WidthRequest="120"
CornerRadius="12"
Padding="6"
Background="{StaticResource LinearBrush}">
<Grid>
<Label
HorizontalOptions="Center"
VerticalOptions="Center"
Text="LinearGradientBrush"/>
</Grid>
</Frame>
</StackLayout>
<ScrollView
Grid.Row="1"
Margin="12, 0"
Padding="12">
<StackLayout>
<Label
Text="Color 1 Offset"/>
<Slider
x:Name="Offset1Slider"
Minimum="0.0"
Maximum="1.0"
Value="0.1"
ValueChanged="OnOffset1SliderValueChanged"/>
<Label
Text="Color 2 Offset"/>
<Slider
x:Name="Offset2Slider"
Minimum="0.0"
Margin="1.0"
Value="0.9"
ValueChanged="OnOffset2SliderValueChanged"/>
</StackLayout>
</ScrollView>
</Grid>
</Grid>
</StackLayout>
</controls:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml;

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

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Brush)]
#endif
#if APP
[XamlCompilation(XamlCompilationOptions.Compile)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 11795, "[Bug] Brushes API - gradient offset does nothing on Android", PlatformAffected.Android)]
public partial class Issue11795 : TestContentPage
{
#if APP
float _offset1, _offset2;
#endif
public Issue11795()
{
#if APP
Title = "Issue 11795";
InitializeComponent();

_offset1 = 0.1f;
_offset2 = 0.9f;
#endif
}

protected override void Init()
{

}

#if APP
void OnOffset1SliderValueChanged(object sender, ValueChangedEventArgs e)
{
_offset1 = (float)e.NewValue;
UpdateBackground(_offset1, _offset2);
}

void OnOffset2SliderValueChanged(object sender, ValueChangedEventArgs e)
{
_offset2 = (float)e.NewValue;
UpdateBackground(_offset1, _offset2);
}

void UpdateBackground(float offset1, float offset2)
{
LinearGradientBrush linearGradient = new LinearGradientBrush
{
StartPoint = new Point(0, 0),
EndPoint = new Point(1, 0),
GradientStops = new GradientStopCollection
{
new GradientStop { Color = Color.YellowGreen, Offset = offset1 },
new GradientStop { Color = Color.Green, Offset = offset2 }
}
};

GradientBoxView.Background = linearGradient;
GradientFrame.Background = linearGradient;
}
#endif
}
}
Loading

0 comments on commit 70e311b

Please sign in to comment.