private void labeledSwitch(String LabelText, Switch Switch = null, Boolean IsSelected = false, _orientation Orientation = _orientation.HORIZONTAL, _labelPosition LabelPosition = _labelPosition.BEFORE, byte[] Sizes = null) { this.Orientation = Orientation; this.LabelPosition = LabelPosition; this.Label = new Label(); this.Label.Text = LabelText; if (Switch == null) { this.Switch = new Switch(); } else { this.Switch = Switch; } byte[] sizes; if (Sizes == null || Sizes.Count() != 2) { sizes = new byte[] { 1, 1 }; } else { sizes = Sizes; } this.Switch.VerticalOptions = LayoutOptions.FillAndExpand; this.Label.VerticalOptions = LayoutOptions.FillAndExpand; if (Orientation == _orientation.HORIZONTAL) { if (LabelPosition == _labelPosition.BEFORE) { this.Label.HorizontalOptions = LayoutOptions.End; this.Children.Add((new GridRow(0, new View[] { this.Label, this.Switch }, sizes, true)).Row); } else { this.Switch.HorizontalOptions = LayoutOptions.Start; this.Children.Add((new GridRow(0, new View[] { this.Switch, this.Label }, sizes, true)).Row); } this.Label.VerticalOptions = LayoutOptions.Center; } else { if (LabelPosition == _labelPosition.BEFORE) { this.Label.HorizontalOptions = LayoutOptions.Start; this.Switch.HorizontalOptions = LayoutOptions.End; this.Children.Add((new GridRow(0, new View[] { this.Label }, null, true)).Row); this.Children.Add((new GridRow(1, new View[] { this.Switch }, null, true)).Row); } else { this.Label.HorizontalOptions = LayoutOptions.End; this.Switch.HorizontalOptions = LayoutOptions.Start; this.Children.Add((new GridRow(0, new View[] { this.Switch }, null, true)).Row); this.Children.Add((new GridRow(1, new View[] { this.Label }, null, true)).Row); } this.Label.HorizontalOptions = LayoutOptions.Center; } this.Switch.IsToggled = IsSelected; }
public LabeledSwitch(String LabelText, Switch Switch = null, Boolean IsSelected = false, _orientation Orientation = _orientation.HORIZONTAL, _labelPosition LabelPosition = _labelPosition.BEFORE, byte[] Sizes = null) { labeledSwitch(LabelText, Switch, IsSelected, Orientation, LabelPosition, Sizes); }
private void labeledPicker(String LabelText, Picker Picker = null, Int32 SelectedIndex = 0, _orientation Orientation = _orientation.HORIZONTAL, _labelPosition LabelPosition = _labelPosition.BEFORE, byte[] Sizes = null) { this.Orientation = Orientation; this.LabelPosition = LabelPosition; this.Label = new Button(); this.Label.Text = LabelText; this.Label.Margin = new Thickness(0, 0, 2, 0); this.Label.BackgroundColor = UIHandler.colorSettings.LabelBackground; this.Label.BorderWidth = 0; if (Picker == null) { this.Picker = new Picker(); } else { this.Picker = Picker; } byte[] sizes; if (Sizes == null || Sizes.Count() != 2) { sizes = new byte[] { 1, 1 }; } else { sizes = Sizes; } this.Picker.VerticalOptions = LayoutOptions.FillAndExpand; this.Label.VerticalOptions = LayoutOptions.FillAndExpand; if (Orientation == _orientation.HORIZONTAL) { if (LabelPosition == _labelPosition.BEFORE) { this.Label.HorizontalOptions = LayoutOptions.End; this.Children.Add((new GridRow(0, new View[] { this.Label, this.Picker }, sizes, true)).Row); } else { this.Picker.HorizontalOptions = LayoutOptions.Start; this.Children.Add((new GridRow(0, new View[] { this.Picker, this.Label }, sizes, true)).Row); } } else { if (LabelPosition == _labelPosition.BEFORE) { this.Label.HorizontalOptions = LayoutOptions.Start; this.Picker.HorizontalOptions = LayoutOptions.End; this.Children.Add((new GridRow(0, new View[] { this.Label }, null, true)).Row); this.Children.Add((new GridRow(1, new View[] { this.Picker }, null, true)).Row); } else { this.Label.HorizontalOptions = LayoutOptions.End; this.Picker.HorizontalOptions = LayoutOptions.Start; this.Children.Add((new GridRow(0, new View[] { this.Picker }, null, true)).Row); this.Children.Add((new GridRow(1, new View[] { this.Label }, null, true)).Row); } } this.Picker.SelectedIndex = SelectedIndex; }
public LabeledPicker(String LabelText, Picker Picker = null, Int32 SelectedIndex = 0, _orientation Orientation = _orientation.HORIZONTAL, _labelPosition LabelPosition = _labelPosition.BEFORE, byte[] Sizes = null) { labeledPicker(LabelText, Picker, SelectedIndex, Orientation, LabelPosition, Sizes); }
private void labeledTextInput(String LabelText, String EditorText = "", _orientation Orientation = _orientation.HORIZONTAL, _labelPosition LabelPosition = _labelPosition.BEFORE, byte[] Sizes = null) { this.Orientation = Orientation; this.LabelPosition = LabelPosition; this.Label = new Button(); this.Label.Text = LabelText; //this.Label.IsEnabled = false; this.Label.Margin = new Thickness(0, 0, 2, 0); this.Label.BackgroundColor = UIHandler.colorSettings.LabelBackground; this.Label.BorderWidth = 0; this.Editor = new Editor(); this.Editor.Text = EditorText; byte[] sizes; if (Sizes == null || Sizes.Count() != 2) { sizes = new byte[] { 1, 1 }; } else { sizes = Sizes; } this.Editor.VerticalOptions = LayoutOptions.FillAndExpand; this.Label.VerticalOptions = LayoutOptions.FillAndExpand; if (Orientation == _orientation.HORIZONTAL) { if (LabelPosition == _labelPosition.BEFORE) { this.Label.HorizontalOptions = LayoutOptions.End; this.Children.Add((new GridRow(0, new View[] { this.Label, this.Editor }, sizes, true)).Row); } else { this.Editor.HorizontalOptions = LayoutOptions.Start; this.Children.Add((new GridRow(0, new View[] { this.Editor, this.Label }, sizes, true)).Row); } } else { if (LabelPosition == _labelPosition.BEFORE) { this.Label.HorizontalOptions = LayoutOptions.Start; this.Editor.HorizontalOptions = LayoutOptions.End; this.Children.Add((new GridRow(0, new View[] { this.Label }, null, true)).Row); this.Children.Add((new GridRow(1, new View[] { this.Editor }, null, true)).Row); } else { this.Label.HorizontalOptions = LayoutOptions.End; this.Editor.HorizontalOptions = LayoutOptions.Start; this.Children.Add((new GridRow(0, new View[] { this.Editor }, null, true)).Row); this.Children.Add((new GridRow(1, new View[] { this.Label }, null, true)).Row); } } }
public LabeledTextInput(String LabelText, String EditorText = "", _orientation Orientation = _orientation.HORIZONTAL, _labelPosition LabelPosition = _labelPosition.BEFORE, byte[] Sizes = null) { labeledTextInput(LabelText, EditorText, Orientation, LabelPosition, Sizes); }