diff --git a/PanCardView/Controls/IndicatorsControl.cs b/PanCardView/Controls/IndicatorsControl.cs index 96236ef..e4dd5b8 100644 --- a/PanCardView/Controls/IndicatorsControl.cs +++ b/PanCardView/Controls/IndicatorsControl.cs @@ -12,7 +12,7 @@ namespace PanCardView.Controls { public class IndicatorsControl : StackLayout { - public static readonly BindableProperty CurrentIndexProperty = BindableProperty.Create(nameof(CurrentIndex), typeof(int), typeof(IndicatorsControl), 0, BindingMode.TwoWay, propertyChanged: (bindable, oldValue, newValue) => + public static readonly BindableProperty SelectedIndexProperty = BindableProperty.Create(nameof(SelectedIndex), typeof(int), typeof(IndicatorsControl), 0, BindingMode.TwoWay, propertyChanged: (bindable, oldValue, newValue) => { bindable.AsIndicatorsControl().ResetIndicatorsStyles(); }); @@ -67,7 +67,7 @@ public IndicatorsControl() Spacing = 5; Orientation = StackOrientation.Horizontal; - this.SetBinding(CurrentIndexProperty, nameof(CardsView.SelectedIndex)); + this.SetBinding(SelectedIndexProperty, nameof(CardsView.SelectedIndex)); this.SetBinding(ItemsCountProperty, nameof(CardsView.ItemsCount)); this.SetBinding(IndicatorsContextsProperty, nameof(CardsView.ItemsSource)); this.SetBinding(IsInteractionRunningProperty, nameof(CardsView.IsPanRunning)); @@ -82,14 +82,14 @@ public IndicatorsControl() _itemTapGesture = new TapGestureRecognizer(); _itemTapGesture.Tapped += (tapSender, tapArgs) => { - CurrentIndex = IndexOf(tapSender as View); + SelectedIndex = IndexOf(tapSender as View); }; } - public int CurrentIndex + public int SelectedIndex { - get => (int)GetValue(CurrentIndexProperty); - set => SetValue(CurrentIndexProperty, value); + get => (int)GetValue(SelectedIndexProperty); + set => SetValue(SelectedIndexProperty, value); } public int ItemsCount @@ -109,6 +109,12 @@ public Style UnselectedIndicatorStyle get => GetValue(UnselectedIndicatorStyleProperty) as Style; set => SetValue(UnselectedIndicatorStyleProperty, value); } + + public bool UseCardItemsAsIndicatorsBindingContexts + { + get => (bool)GetValue(UseCardItemsAsIndicatorsBindingContextsProperty); + set => SetValue(UseCardItemsAsIndicatorsBindingContextsProperty, value); + } public bool IsInteractionRunning { @@ -133,12 +139,6 @@ public DataTemplate ItemTemplate get => GetValue(ItemTemplateProperty) as DataTemplate; set => SetValue(ItemTemplateProperty, value); } - - public bool UseCardItemsAsIndicatorsBindingContexts - { - get => (bool)GetValue(UseCardItemsAsIndicatorsBindingContextsProperty); - set => SetValue(UseCardItemsAsIndicatorsBindingContextsProperty, value); - } public bool UseParentAsBindingContext { @@ -255,7 +255,7 @@ private void ApplyStyle(View view, int cyclingIndex) private void ResetIndicatorsStylesNonBatch() { - var cyclingIndex = CurrentIndex.ToCyclingIndex(ItemsCount); + var cyclingIndex = SelectedIndex.ToCyclingIndex(ItemsCount); OnResetIndicatorsStyles(cyclingIndex); }