Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
IeuanWalker committed Apr 5, 2023
1 parent c2d9e8f commit d600fd1
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/AndroidSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
HeightRequest="20"
HorizontalOptions="Center"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="#fafafa"
KnobBackgroundColor="#fafafa"
KnobHeight="34"
KnobLimit="Max"
KnobWidth="34"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static void CustomSwitch_SwitchPanUpdate(CustomSwitch customSwitch, SwitchPanUpd

double t = e.Percentage * 0.01;

customSwitch.KnobColor = ColorAnimationUtil.ColorAnimation(fromSwitchColor, toSwitchColor, t);
customSwitch.KnobBackgroundColor = ColorAnimationUtil.ColorAnimation(fromSwitchColor, toSwitchColor, t);
customSwitch.BackgroundColor = ColorAnimationUtil.ColorAnimation(fromColor, toColor, t);
}
}
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/IosSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<switch:CustomSwitch HeightRequest="40"
HorizontalKnobMargin="1"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="White"
KnobBackgroundColor="White"
KnobHeight="36"
KnobLimit="Boundary"
KnobWidth="36"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void CustomSwitch_SwitchPanUpdate(CustomSwitch customSwitch, SwitchPanUpdatedEve
new CornerRadius(zeroToFive, fiveToZero, zeroToFive, fiveToZero) :
new CornerRadius(fiveToZero, zeroToFive, fiveToZero, zeroToFive)
};
customSwitch.KnobColor = ColorAnimationUtil.ColorAnimation(fromColorLight, toColorLight, t);
customSwitch.KnobBackgroundColor = ColorAnimationUtil.ColorAnimation(fromColorLight, toColorLight, t);
customSwitch.KnobStroke = ColorAnimationUtil.ColorAnimation(fromColorDark, toColorDark, t);
}

Expand Down
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/Other2Switch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
HeightRequest="40"
HorizontalKnobMargin="3"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="Red"
KnobBackgroundColor="Red"
KnobHeight="36"
KnobLimit="Boundary"
KnobWidth="36"
Expand Down
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/Other3Switch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
HeightRequest="35"
HorizontalKnobMargin="-1"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="White"
KnobBackgroundColor="White"
KnobHeight="40"
KnobLimit="Boundary"
KnobWidth="42"
Expand Down
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/Other4Switch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<switch:CustomSwitch BackgroundColor="#f3f3f2"
HeightRequest="50"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="White"
KnobBackgroundColor="White"
KnobHeight="60"
KnobLimit="Boundary"
KnobWidth="60"
Expand Down
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/Other5Switch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<switch:CustomSwitch BackgroundColor="White"
HeightRequest="50"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="DeepPink"
KnobBackgroundColor="DeepPink"
KnobHeight="60"
KnobLimit="Boundary"
KnobWidth="60"
Expand Down
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/Theme1Switch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<switch:CustomSwitch BackgroundColor="White"
HeightRequest="50"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="Transparent"
KnobBackgroundColor="Transparent"
KnobHeight="36"
KnobLimit="Boundary"
KnobWidth="45"
Expand Down
2 changes: 1 addition & 1 deletion Demo/App/Controls/CustomSwitchExamples/Theme2Switch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
HeightRequest="40"
HorizontalKnobMargin="2"
IsToggled="{Binding IsToggled, Source={RelativeSource AncestorType={x:Type ContentView}}}"
KnobColor="White"
KnobBackgroundColor="White"
KnobHeight="36"
KnobLimit="Boundary"
KnobWidth="36"
Expand Down
2 changes: 1 addition & 1 deletion Scr/Switch/CustomSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Border x:Name="KnobFrame"
Padding="0"
Background="{Binding KnobBackground, Source={RelativeSource AncestorType={x:Type ContentView}}}"
BackgroundColor="{Binding KnobColor, Source={RelativeSource AncestorType={x:Type ContentView}}}"
BackgroundColor="{Binding KnobBackgroundColor, Source={RelativeSource AncestorType={x:Type ContentView}}}"
Content="{Binding KnobContent, Source={RelativeSource AncestorType={x:Type ContentView}}}"
HeightRequest="{Binding KnobHeight, Source={RelativeSource AncestorType={x:Type ContentView}}}"
HorizontalOptions="Center"
Expand Down
8 changes: 4 additions & 4 deletions Scr/Switch/CustomSwitch.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ public Brush KnobBackground
set => SetValue(KnobBackgroundProperty, value);
}

public static readonly BindableProperty KnobColorProperty = BindableProperty.Create(nameof(KnobColor), typeof(Color), typeof(CustomSwitch), Colors.Transparent);
public static readonly BindableProperty KnobBackgroundColorProperty = BindableProperty.Create(nameof(KnobBackgroundColor), typeof(Color), typeof(CustomSwitch), Colors.Transparent);

public Color KnobColor
public Color KnobBackgroundColor
{
get => (Color)GetValue(KnobColorProperty);
set => SetValue(KnobColorProperty, value);
get => (Color)GetValue(KnobBackgroundColorProperty);
set => SetValue(KnobBackgroundColorProperty, value);
}

public static readonly BindableProperty KnobStrokeShapeProperty = BindableProperty.Create(nameof(KnobStrokeShape), typeof(IShape), typeof(CustomSwitch), new Rectangle());
Expand Down

0 comments on commit d600fd1

Please sign in to comment.