Skip to content

Commit

Permalink
Fixed naming of indicators property
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMisiukevich committed Jul 19, 2018
1 parent e81e69b commit 856f82a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions PanCardView/Controls/IndicatorsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down Expand Up @@ -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));
Expand All @@ -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
Expand All @@ -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
{
Expand All @@ -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
{
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 856f82a

Please sign in to comment.