using System; using InABox.Mobile; using PRS.Mobile; using Syncfusion.DocIO.DLS; using Xamarin.Forms; namespace PRS.Mobile { public delegate void CustomBooleanValueChanged(bool value); class CustomBoolean : MobileTabStrip { public event CustomBooleanValueChanged OnCustomBooleanValueChanged; public bool ValueChanged { get; set; } public bool Value { get => SelectedItem?.Index == 0; set => SelectedItem = (value ? Items[0] : Items[1]); } public string TrueValue { get => Items[0].Text; set => Items[0].Text = value; } public string FalseValue { get => Items[1].Text; set => Items[1].Text = value; } public CustomBoolean(int rbGroup) { HeightRequest = 35; Items.Add(new MobileTabStripItem() { Text = "Yes"}); Items.Add(new MobileTabStripItem() { Text = "No"}); BorderColor = XF.Material.Forms.Material.Color.SecondaryVariant; UnselectedBackground = XF.Material.Forms.Material.Color.Secondary; UnselectedForeground = XF.Material.Forms.Material.Color.OnSecondary; SelectedBackground = XF.Material.Forms.Material.Color.Surface; SelectedForeground = XF.Material.Forms.Material.Color.OnSurface; SelectionChanged += (sender, args) => { OnCustomBooleanValueChanged?.Invoke(Value); }; } } }