private void SetActiveButton(int index)
 {
     if (index < 0 || index > SegmentedButtons.Count - 1)
     {
         SetActiveButton(null);
         return;
     }
     else
     {
         var activeButton = SegmentedButtons.ToList().ElementAt(index);
         SetActiveButton(activeButton);
     }
 }
 private void SetActiveButton(SegmentedButton activeButton)
 {
     if (SegmentedButtons == null)
     {
         return;
     }
     foreach (var item in SegmentedButtons)
     {
         if (item == activeButton)
         {
             item.TextColor     = ActiveTextColor;
             item.Icon          = ActiveIcon;
             this.SelectedIndex = SegmentedButtons.ToList().IndexOf(activeButton);
         }
         else
         {
             item.TextColor = InactiveTextColor;
             item.Icon      = InactiveIcon;
         }
     }
 }