public MainPage() { InitializeComponent(); this.BindingContext = App.MainViewModel; Color color = Color.FromHex("#FFF571"); _accentColor = color.ToSKColor(); _accentDarkColor = color.WithLuminosity(color.Luminosity - .2).ToSKColor(); //Darken the color (Luminosity goes from 0 to 1, default is 1) _accentExtraDarkColor = color.WithLuminosity(color.Luminosity - .25).ToSKColor(); //Even darker _accentPaint = new SKPaint() { Color = _accentColor }; _accentDarkPaint = new SKPaint() { Color = _accentDarkColor }; _accentExtraDarkPaint = new SKPaint() { Color = _accentExtraDarkColor }; var eff = new XFUtils.Effects.ScrollReporterEffect(); eff.ScrollChanged += Eff_ScrollChanged; //attach this effect to listview to get the Y position of the scroll BooksListView.Effects.Add(eff); }
protected override void OnAttached() { if (Element is ListView == false) { return; } effect = (RoutingEffects.ScrollReporterEffect)Element.Effects.FirstOrDefault(e => e is RoutingEffects.ScrollReporterEffect); _offsetObserver = ((UITableView)Control).AddObserver("contentOffset", Foundation.NSKeyValueObservingOptions.New, HandleAction); }
protected override void OnAttached() { var listView = Control as Windows.UI.Xaml.Controls.ListView; effect = (RoutingEffects.ScrollReporterEffect)Element.Effects.FirstOrDefault((object e) => e is RoutingEffects.ScrollReporterEffect); //scrollViewer = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(listView, 0), 0) as ScrollViewer; scrollViewer = GetScrollViewer(listView); scrollViewer.ViewChanging += ScrollViewer_ViewChanging; }
protected override void OnAttached() { if (Element is Xamarin.Forms.ListView == false) { return; } effect = (RoutingEffects.ScrollReporterEffect)Element.Effects.FirstOrDefault(e => e is RoutingEffects.ScrollReporterEffect); Density = ((Android.Widget.ListView)Control).Context.Resources.DisplayMetrics.Density; ((Android.Widget.ListView)Control).Scroll += ScrollReporterEffect_Scroll; }