protected override void OnAttached ()
{
Control.SetBackgroundColor (global::Android.Graphics.Color.Aqua);
+
+ var childLabel = (Element as ScrollView)?.Content as Label;
+ if (childLabel != null)
+ childLabel.Text = "Success";
}
protected override void OnDetached ()
protected override void OnAttached()
{
Control.BackgroundColor = UIColor.Blue;
+
+ var childLabel = (Element as ScrollView)?.Content as Label;
+ if (childLabel != null)
+ childLabel.Text = "Success";
}
protected override void OnDetached()
--- /dev/null
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+// Apply the default category of "Issues" to all of the tests in this assembly
+// We use this as a catch-all for tests which haven't been individually categorized
+#if UITEST
+[assembly: NUnit.Framework.Category("Issues")]
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 45874, "Effect not attaching to ScrollView", PlatformAffected.iOS | PlatformAffected.Android)]
+ public class Bugzilla45874 : TestContentPage
+ {
+ const string Success = "Success";
+
+ protected override void Init()
+ {
+ var label = new Label { Text = "FAIL" };
+
+ var scrollView = new ScrollView { Content = label };
+
+ var effect = Effect.Resolve("XamControl.BorderEffect");
+
+ scrollView.Effects.Add(effect);
+
+ Content = scrollView;
+ }
+
+#if UITEST
+ [Test]
+ public void Bugzilla45874Test()
+ {
+ RunningApp.WaitForElement(q => q.Marked(Success));
+ }
+#endif
+ }
+}
\ No newline at end of file
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla51505.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla52533.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla53362.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla45874.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1075.cs" />
using Android.Graphics;
using Android.Views;
using Android.Widget;
+using Xamarin.Forms.Internals;
using AScrollView = Android.Widget.ScrollView;
namespace Xamarin.Forms.Platform.Android
{
- public class ScrollViewRenderer : AScrollView, IVisualElementRenderer
+ public class ScrollViewRenderer : AScrollView, IVisualElementRenderer, IEffectControlProvider
{
ScrollViewContainer _container;
HorizontalScrollView _hScrollView;
if (!string.IsNullOrEmpty(element.AutomationId))
ContentDescription = element.AutomationId;
}
+
+ EffectUtilities.RegisterEffectControlProvider(this, oldElement, element);
}
public VisualElementTracker Tracker { get; private set; }
}
}
+ void IEffectControlProvider.RegisterEffect(Effect effect)
+ {
+ var platformEffect = effect as PlatformEffect;
+ if (platformEffect != null)
+ OnRegisterEffect(platformEffect);
+ }
+
+ void OnRegisterEffect(PlatformEffect effect)
+ {
+ effect.SetContainer(this);
+ effect.SetControl(this);
+ }
+
static int GetDistance(double start, double position, double v)
{
return (int)(start + (position - start) * v);