diff --git a/Ooui.Forms/Renderers/ListViewRenderer.cs b/Ooui.Forms/Renderers/ListViewRenderer.cs index 98cf5a3..9f50610 100644 --- a/Ooui.Forms/Renderers/ListViewRenderer.cs +++ b/Ooui.Forms/Renderers/ListViewRenderer.cs @@ -41,6 +41,7 @@ namespace Ooui.Forms.Renderers e.NewElement.ScrollToRequested += ListView_ScrollToRequested; UpdateItems (); + UpdateSeparator (); UpdateBackgroundColor (); } @@ -53,6 +54,10 @@ namespace Ooui.Forms.Renderers if (e.PropertyName == ItemsView.ItemsSourceProperty.PropertyName) UpdateItems (); + else if (e.PropertyName == Xamarin.Forms.ListView.SeparatorColorProperty.PropertyName) + UpdateSeparator (); + else if (e.PropertyName == Xamarin.Forms.ListView.SeparatorVisibilityProperty.PropertyName) + UpdateSeparator (); } protected override void Dispose (bool disposing) @@ -76,6 +81,7 @@ namespace Ooui.Forms.Renderers private void OnCollectionChanged (object sender, NotifyCollectionChangedEventArgs e) { UpdateItems (); + UpdateSeparator (); } private void UnsubscribeCellClicks () @@ -134,6 +140,27 @@ namespace Ooui.Forms.Renderers } } + private void UpdateSeparator() + { + if (Control == null) + return; + + var listItems = Control.Children.OfType().ToList(); + + foreach (var li in listItems) + { + if (Element.SeparatorVisibility == SeparatorVisibility.Default) + { + var color = Element.SeparatorColor.ToOouiColor(Color.FromStyleValue("#999")); + li.Style["border-bottom"] = string.Format("{0}px {1} {2}", 1, "solid", color.ToString()); + } + else + { + li.Style["border-bottom"] = null; + } + } + } + void ListItem_Click (object sender, TargetEventArgs e) { if (Control == null)