diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs index 8255ccb381a..ca7a4c8182e 100644 --- a/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs +++ b/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs @@ -4,8 +4,8 @@ using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; +using System.Threading.Tasks; using Xamarin.Forms.CustomAttributes; -using System.Threading; using Xamarin.Forms.Internals; using Xamarin.Forms.PlatformConfiguration; @@ -267,6 +267,16 @@ protected override void Build(StackLayout stackLayout) fastScrollItemContainer.View.On().SetIsFastScrollEnabled(true); fastScrollItemContainer.View.ItemsSource = viewModel.CategorizedEmployees; + var refreshControlColorContainer = new ViewContainer(Test.ListView.RefreshControlColor, new ListView()); + InitializeElement(refreshControlColorContainer.View); + refreshControlColorContainer.View.RefreshControlColor = Color.Red; + refreshControlColorContainer.View.IsPullToRefreshEnabled = true; + refreshControlColorContainer.View.Refreshing += async (object sender, EventArgs e) => { + await Task.Delay(2000); + refreshControlColorContainer.View.IsRefreshing = false; + }; + refreshControlColorContainer.View.ItemsSource = viewModel.Employees; + var scrollbarVisibilityContainer = new ViewContainer(Test.ListView.ScrollBarVisibility, new ListView()); InitializeElement(scrollbarVisibilityContainer.View); scrollbarVisibilityContainer.View.HorizontalScrollBarVisibility = ScrollBarVisibility.Never; @@ -287,6 +297,7 @@ protected override void Build(StackLayout stackLayout) Add(rowHeightContainer); Add(selectedItemContainer); Add(fastScrollItemContainer); + Add(refreshControlColorContainer); Add(scrollbarVisibilityContainer); } } diff --git a/Xamarin.Forms.Core/ListView.cs b/Xamarin.Forms.Core/ListView.cs index c12f331ab0f..de8ddbe7bfa 100644 --- a/Xamarin.Forms.Core/ListView.cs +++ b/Xamarin.Forms.Core/ListView.cs @@ -46,6 +46,8 @@ public class ListView : ItemsView, IListViewController, IElementConfigurat public static readonly BindableProperty SeparatorColorProperty = BindableProperty.Create("SeparatorColor", typeof(Color), typeof(ListView), Color.Default); + public static readonly BindableProperty RefreshControlColorProperty = BindableProperty.Create(nameof(RefreshControlColor), typeof(Color), typeof(ListView), Color.Default); + public static readonly BindableProperty HorizontalScrollBarVisibilityProperty = BindableProperty.Create(nameof(HorizontalScrollBarVisibility), typeof(ScrollBarVisibility), typeof(ListView), ScrollBarVisibility.Default); public static readonly BindableProperty VerticalScrollBarVisibilityProperty = BindableProperty.Create(nameof(VerticalScrollBarVisibility), typeof(ScrollBarVisibility), typeof(ListView), ScrollBarVisibility.Default); @@ -223,6 +225,12 @@ public Color SeparatorColor set { SetValue(SeparatorColorProperty, value); } } + public Color RefreshControlColor + { + get { return (Color)GetValue(RefreshControlColorProperty); } + set { SetValue(RefreshControlColorProperty, value); } + } + public SeparatorVisibility SeparatorVisibility { get { return (SeparatorVisibility)GetValue(SeparatorVisibilityProperty); } diff --git a/Xamarin.Forms.CustomAttributes/TestAttributes.cs b/Xamarin.Forms.CustomAttributes/TestAttributes.cs index 928087216d3..c7d092aa07c 100644 --- a/Xamarin.Forms.CustomAttributes/TestAttributes.cs +++ b/Xamarin.Forms.CustomAttributes/TestAttributes.cs @@ -431,6 +431,7 @@ public enum ListView GroupShortNameBinding, ScrollTo, FastScroll, + RefreshControlColor, ScrollBarVisibility } diff --git a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs index 3e74b8dabf7..a653c85cad5 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs @@ -178,6 +178,7 @@ protected override void OnElementChanged(ElementChangedEventArgs e) UpdateIsSwipeToRefreshEnabled(); UpdateFastScrollEnabled(); UpdateSelectionMode(); + UpdateSpinnerColor(); UpdateHorizontalScrollBarVisibility(); UpdateVerticalScrollBarVisibility(); } @@ -217,6 +218,8 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE UpdateFastScrollEnabled(); else if (e.PropertyName == ListView.SelectionModeProperty.PropertyName) UpdateSelectionMode(); + else if (e.PropertyName == ListView.RefreshControlColorProperty.PropertyName) + UpdateSpinnerColor(); else if (e.PropertyName == ScrollView.HorizontalScrollBarVisibilityProperty.PropertyName) UpdateHorizontalScrollBarVisibility(); else if (e.PropertyName == ScrollView.VerticalScrollBarVisibilityProperty.PropertyName) @@ -419,6 +422,12 @@ void UpdateSelectionMode() } } + void UpdateSpinnerColor() + { + if (_refresh != null) + _refresh.SetColorSchemeColors(Element.RefreshControlColor.ToAndroid()); + } + void UpdateHorizontalScrollBarVisibility() { if (_defaultHorizontalScrollVisibility == 0) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs index bf7d6790424..170132d0cdf 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs @@ -249,6 +249,7 @@ protected override void OnElementChanged(ElementChangedEventArgs e) UpdateSeparatorColor(); UpdateSeparatorVisibility(); UpdateSelectionMode(); + UpdateSpinnerColor(); UpdateVerticalScrollBarVisibility(); UpdateHorizontalScrollBarVisibility(); @@ -289,6 +290,8 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE UpdatePullToRefreshEnabled(); else if (e.PropertyName == Xamarin.Forms.ListView.SelectionModeProperty.PropertyName) UpdateSelectionMode(); + else if (e.PropertyName == Xamarin.Forms.ListView.RefreshControlColorProperty.PropertyName) + UpdateSpinnerColor(); else if (e.PropertyName == ScrollView.VerticalScrollBarVisibilityProperty.PropertyName) UpdateVerticalScrollBarVisibility(); else if (e.PropertyName == ScrollView.HorizontalScrollBarVisibilityProperty.PropertyName) @@ -682,6 +685,14 @@ void UpdateSelectionMode() } } + void UpdateSpinnerColor() + { + var color = Element.RefreshControlColor; + + if (_tableViewController != null) + _tableViewController.UpdateRefreshControlColor(color == Color.Default ? null : color.ToUIColor()); + } + void UpdateVerticalScrollBarVisibility() { if (_defaultVerticalScrollVisibility == null) @@ -1463,6 +1474,12 @@ public override void ViewWillAppear(bool animated) UpdateIsRefreshing(true); } + public void UpdateRefreshControlColor(UIColor color) + { + if (RefreshControl != null) + RefreshControl.TintColor = color; + } + protected override void Dispose(bool disposing) { if (_disposed) diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/ListView.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/ListView.xml new file mode 100644 index 00000000000..316b5734559 --- /dev/null +++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/ListView.xml @@ -0,0 +1,1170 @@ + + + + + Xamarin.Forms.Core + 2.0.0.0 + + + Xamarin.Forms.ItemsView<Xamarin.Forms.Cell> + + Xamarin.Forms.Cell + + + + + Xamarin.Forms.IElementConfiguration<Xamarin.Forms.ListView> + + + Xamarin.Forms.IListViewController + + + + + Xamarin.Forms.RenderWith(typeof(Xamarin.Forms.Platform._ListViewRenderer)) + + + + To be added. + To be added. + + + + + + Constructor + + 2.0.0.0 + + + + To be added. + To be added. + + + + + + Constructor + + 2.0.0.0 + + + + + + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Void + + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + Xamarin.Forms.ListViewCachingStrategy + + + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + Xamarin.Forms.Cell + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + Xamarin.Forms.Cell + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Void + + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Object + + + To be added. + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + Xamarin.Forms.Element + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.DataTemplate + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.String + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.BindingBase + + + To be added. + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.DataTemplate + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.BindingBase + + + To be added. + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Boolean + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Object + + + To be added. + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + Xamarin.Forms.Element + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.DataTemplate + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Boolean + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Boolean + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Boolean + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Event + + 2.0.0.0 + + + System.EventHandler<Xamarin.Forms.ItemVisibilityEventArgs> + + + To be added. + To be added. + + + + + + Event + + 2.0.0.0 + + + System.EventHandler<Xamarin.Forms.ItemVisibilityEventArgs> + + + To be added. + To be added. + + + + + + Event + + 2.0.0.0 + + + System.EventHandler<Xamarin.Forms.SelectedItemChangedEventArgs> + + + To be added. + To be added. + + + + + + Event + + 2.0.0.0 + + + System.EventHandler<Xamarin.Forms.ItemTappedEventArgs> + + + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.Void + + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.Void + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + Xamarin.Forms.IPlatformElementConfiguration<T,Xamarin.Forms.ListView> + + + + + Xamarin.Forms.IConfigPlatform + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Void + + + + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.Obsolete("OnSizeRequest is obsolete as of version 2.2.0. Please use OnMeasure instead.") + + + + Xamarin.Forms.SizeRequest + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.Boolean + + + To be added. + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Windows.Input.ICommand + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.Color + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Event + + 2.0.0.0 + + + System.EventHandler + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Int32 + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Void + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Void + + + + + + + + + To be added. + To be added. + To be added. + To be added. + To be added. + To be added. + + + + + + Event + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.EventHandler<Xamarin.Forms.ScrollToRequestedEventArgs> + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + System.Object + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.ListViewSelectionMode + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.Void + + + + + + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.Void + + + + + + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + + System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never) + + + + System.Void + + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.Color + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Property + + 2.0.0.0 + + + Xamarin.Forms.SeparatorVisibility + + + To be added. + To be added. + To be added. + + + + + + Field + + 2.0.0.0 + + + Xamarin.Forms.BindableProperty + + + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Void + + + + + + + To be added. + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Void + + + + + + To be added. + To be added. + To be added. + + + + + + Method + + 2.0.0.0 + + + System.Boolean + + + + + + To be added. + To be added. + To be added. + To be added. + + + +