void SetCapsUnits(object sender = null, Forms9Patch.SegmentedControlEventArgs args = null) { if (capsUnitsSegmentedControl.IsIndexSelected(0)) { capsInsetsLeftSlider.Maximum = 200; capsInsetsLeftSlider.Value = 0; capsInsetsRightSlider.Maximum = 200; capsInsetsRightSlider.Value = 0; capsInsetsTopSlider.Maximum = 200; capsInsetsTopSlider.Value = 0; capsInsetsBottomSlider.Maximum = 200; capsInsetsBottomSlider.Value = 0; } else { capsInsetsLeftSlider.Maximum = 100; capsInsetsLeftSlider.Value = 0; capsInsetsRightSlider.Maximum = 100; capsInsetsRightSlider.Value = 0; capsInsetsTopSlider.Maximum = 100; capsInsetsTopSlider.Value = 0; capsInsetsBottomSlider.Maximum = 100; capsInsetsBottomSlider.Value = 0; } SetCapsInsets(); }
private void CapsInsetsSlider_ValueChanged(object sender, ValueChangedEventArgs e) { double scale = capsUnitsSegmentedControl.IsIndexSelected(0) ? 1 : 0.01; // pixelCapsSwitch.IsToggled ? 1 : 0.01; var capsInset = new Thickness(capsInsetsLeftSlider.Value * scale, capsInsetsTopSlider.Value * scale, capsInsetsRightSlider.Value * scale, capsInsetsBottomSlider.Value * scale); //System.Diagnostics.Debug.WriteLine("CapsInset=[" + Forms9Patch.ThicknessExtension.Description(capsInset) + "]"); _f9pImage.CapInsets = capsInset; }
private void HzOptionSegmentedControl_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e) { switch (e.Segment.Text) { case "START": hzOptionSegmentedControl.SelectIndex(0); _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.StartAndExpand : LayoutOptions.Start); hzOptionSegmentedControl.DeselectIndex(1); hzOptionSegmentedControl.DeselectIndex(2); hzOptionSegmentedControl.DeselectIndex(3); break; case "CENTER": hzOptionSegmentedControl.SelectIndex(1); _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.CenterAndExpand : LayoutOptions.Center); hzOptionSegmentedControl.DeselectIndex(0); hzOptionSegmentedControl.DeselectIndex(2); hzOptionSegmentedControl.DeselectIndex(3); break; case "END": hzOptionSegmentedControl.SelectIndex(2); _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.EndAndExpand : LayoutOptions.End); hzOptionSegmentedControl.DeselectIndex(0); hzOptionSegmentedControl.DeselectIndex(1); hzOptionSegmentedControl.DeselectIndex(3); break; case "FILL": hzOptionSegmentedControl.SelectIndex(3); _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.FillAndExpand : LayoutOptions.Fill); hzOptionSegmentedControl.DeselectIndex(0); hzOptionSegmentedControl.DeselectIndex(1); hzOptionSegmentedControl.DeselectIndex(2); break; case "EXPAND": _f9pButton.HorizontalOptions = new LayoutOptions(_f9pButton.HorizontalOptions.Alignment, e.Segment.IsSelected); break; } _xfButton.HorizontalOptions = _f9pButton.HorizontalOptions; }
private void VtOptionSegmentedControl_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e) { switch (e.Segment.Text) { case "START": vtOptionSegmentedControl.SelectIndex(0); f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.StartAndExpand : LayoutOptions.Start); vtOptionSegmentedControl.DeselectIndex(1); vtOptionSegmentedControl.DeselectIndex(2); vtOptionSegmentedControl.DeselectIndex(3); break; case "CENTER": vtOptionSegmentedControl.SelectIndex(1); f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.CenterAndExpand : LayoutOptions.Center); vtOptionSegmentedControl.DeselectIndex(0); vtOptionSegmentedControl.DeselectIndex(2); vtOptionSegmentedControl.DeselectIndex(3); break; case "END": vtOptionSegmentedControl.SelectIndex(2); f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.EndAndExpand : LayoutOptions.End); vtOptionSegmentedControl.DeselectIndex(0); vtOptionSegmentedControl.DeselectIndex(1); vtOptionSegmentedControl.DeselectIndex(3); break; case "FILL": vtOptionSegmentedControl.SelectIndex(3); f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.FillAndExpand : LayoutOptions.Fill); vtOptionSegmentedControl.DeselectIndex(0); vtOptionSegmentedControl.DeselectIndex(1); vtOptionSegmentedControl.DeselectIndex(2); break; case "EXPAND": f9pImage.VerticalOptions = new LayoutOptions(f9pImage.VerticalOptions.Alignment, e.Segment.IsSelected); break; } xamarinImage.VerticalOptions = f9pImage.VerticalOptions; }