Last active
August 29, 2015 14:23
-
-
Save chrisriesgo/2ba8873db358131d0b8d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ItemsSourceChanged () | |
{ | |
if (ItemsSource == null) return; | |
var countDelta = ItemsSource.Count - Children.Count; | |
if (countDelta > 0) { | |
for (var i = 0; i < countDelta; i++) | |
{ | |
CreateDot(); | |
} | |
} | |
else if (countDelta < 0) | |
{ | |
for (var i = 0; i < -countDelta; i++) | |
{ | |
Children.RemoveAt (0); | |
} | |
} | |
} | |
public PagerIndicatorDots() | |
{ | |
HorizontalOptions = LayoutOptions.CenterAndExpand; | |
VerticalOptions = LayoutOptions.Center; | |
Orientation = StackOrientation.Horizontal; | |
DotColor = Color.Black; | |
} | |
void CreateDot() | |
{ | |
//Make one button and add it to the layout | |
var dot = new Button { | |
BorderRadius = Convert.ToInt32(DotSize/2), | |
HeightRequest = DotSize, | |
WidthRequest = DotSize, | |
BackgroundColor = DotColor | |
}; | |
Children.Add(dot); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment