VasenevEA / MultipleToggleSwitch

Multiple position Toogle Switch control for Xamarin Forms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MultipleToogleSwitch

Multiple position Toogle Switch control for Xamarin Forms

This is a ContentView based Control. Requeires - None;

How to use:

  • add files to your pcl/.net Standart project

    • MultiToogleSwitch.xaml
    • MultiToogleSwitch.xaml.cs
    • ToogleCustomButton.cs
  • paste code on your page/view\

<local:MultiToogleSwitch Toggles="{Binding Toggles}" 
                                 SelectedId="{Binding SelectedId, Mode=TwoWay}"
                                 HorizontalOptions="Center"
                                 VerticalOptions="Center"
                                 EvenWidth="True"
                                 FontSize="14"/>
  • In your ViewModel add property ( array of buttons text)
public string[] Toggles { get; set; } = new string[] { "On", "Auto", "Off", "Some" };
  • Bind SelectedId property
  • You can change some parameters
public new Color BackgroundColor { get; set; }
public Color SelectedColor { get; set; }
public Color DefaultColor { get; set; }

public Color SelectedBorderColor { get; set; }
public Color DefaultBorderColor { get; set; }
public float CornerRadius { get; set; }
public double FontSize { get; set; }
  • Profit!
public string[] Toggles { get; set; } = new string[] { "On", "Auto", "Off"};

public string[] Toggles { get; set; } = new string[] { "On", "Auto", "Off", "Some" };

About

Multiple position Toogle Switch control for Xamarin Forms


Languages

Language:C# 100.0%