protected virtual bool IsSlidable(PropertyDescriptor descriptor, out double min, out double max, out double largeChange, out double smallChange, out double tickFrequency, out bool snapToTicks, out TickPlacement tickPlacement) { min = max = largeChange = smallChange = 0; tickFrequency = 1; snapToTicks = false; tickPlacement = TickPlacement.None; bool result = false; var sa = AttributeHelper.GetFirstAttribute <SlidableAttribute>(descriptor); if (sa != null) { min = sa.Minimum; max = sa.Maximum; largeChange = sa.LargeChange; smallChange = sa.SmallChange; snapToTicks = sa.SnapToTicks; tickFrequency = sa.TickFrequency; tickPlacement = sa.TickPlacement; result = true; } return(result); }
void UpdateReservedSpace() { double reserved_space = Orientation == Orientation.Horizontal ? track.Thumb.ActualWidth : track.Thumb.ActualHeight; TickPlacement tick_placement = TickPlacement; GetTopTick().ReservedSpace = tick_placement == TickPlacement.TopLeft || tick_placement == TickPlacement.Both ? reserved_space : 0; GetBottomTick().ReservedSpace = tick_placement == TickPlacement.BottomRight || tick_placement == TickPlacement.Both ? reserved_space : 0; }
private void SerializeProperties(IDictionary <string, object> options) { FluentDictionary.For(options) .Add("orientation", Orientation.ToString().ToLowerInvariant(), () => Orientation.HasValue) .Add("tickPlacement", TickPlacement.ToString().ToLowerInvariant(), () => TickPlacement.HasValue) .Add("smallStep", SmallStep, () => SmallStep.HasValue) .Add("largeStep", LargeStep, () => LargeStep.HasValue) .Add("leftDragHandleTitle", LeftDragHandleTitle, () => LeftDragHandleTitle.HasValue()) .Add("rightDragHandleTitle", RightDragHandleTitle, () => RightDragHandleTitle.HasValue()) .Add("min", Min, () => Min.HasValue) .Add("max", Max, () => Max.HasValue); Settings.SerializeTo("tooltip", options); }
private void SerializeProperties(IDictionary <string, object> options) { FluentDictionary.For(options) .Add("orientation", Orientation.ToString().ToLowerInvariant(), () => Orientation.HasValue) .Add("tickPlacement", TickPlacement.ToString().ToLowerInvariant(), () => TickPlacement.HasValue) .Add("dragHandleTitle", DragHandleTitle, () => DragHandleTitle.HasValue()) .Add("increaseButtonTitle", IncreaseButtonTitle, () => IncreaseButtonTitle.HasValue()) .Add("decreaseButtonTitle", DecreaseButtonTitle, () => DecreaseButtonTitle.HasValue()) .Add("showButtons", ShowButtons, () => ShowButtons.HasValue) .Add("smallStep", SmallStep, () => SmallStep.HasValue) .Add("largeStep", LargeStep, () => LargeStep.HasValue) .Add("min", Min, () => Min.HasValue) .Add("max", Max, () => Max.HasValue); Settings.SerializeTo("tooltip", options); }
protected virtual bool IsSlidable(PropertyDescriptor descriptor, out double min, out double max, out double largeChange, out double smallChange, out double tickFrequency, out bool snapToTicks, out TickPlacement tickPlacement) { min = max = largeChange = smallChange = 0; tickFrequency = 1; snapToTicks = false; tickPlacement = TickPlacement.None; bool result = false; var sa = AttributeHelper.GetFirstAttribute<SlidableAttribute>(descriptor); if (sa != null) { min = sa.Minimum; max = sa.Maximum; largeChange = sa.LargeChange; smallChange = sa.SmallChange; snapToTicks = sa.SnapToTicks; tickFrequency = sa.TickFrequency; tickPlacement = sa.TickPlacement; result = true; } return result; }
public SlidableAttribute(double minimum, double maximum, double smallChange, double largeChange, bool snapToTicks, double tickFrequency, TickPlacement tickPlacement) : this(minimum, maximum, smallChange, largeChange, snapToTicks, tickFrequency) { TickPlacement = tickPlacement; }
public static T TickPlacement <T>(this T target, TickPlacement value) where T : Slider { target.TickPlacement = value; return(target); }
protected virtual void OnTickPlacementChanged(TickPlacement oldValue, TickPlacement newValue) { }
private static void OnTickPlacementChanged(SliderEx slider, AvaloniaPropertyChangedEventArgs e) { if (slider.TopTickBar == null || slider.BottomTickBar == null) { return; } //strange behaviour in the view //right now we skip this if (slider.Orientation == Orientation.Vertical) { return; } //TopTickBar.Width = this.Width; //BottomTickBar.Width = this.Width; if (slider.Track?.Thumb != null) { switch (slider.Orientation) { case Orientation.Horizontal: if (DoubleUtil.IsDoubleFinite(slider.Track.Thumb.Width)) { slider.TopTickBar.ReservedSpace = slider.Track.Thumb.Width; } break; case Orientation.Vertical: if (DoubleUtil.IsDoubleFinite(slider.Track.Thumb.Height)) { slider.TopTickBar.ReservedSpace = slider.Track.Thumb.Height; } break; } } if (slider.Orientation == Orientation.Horizontal) { slider.Track.Thumb.Classes.Set("HorizontalSliderUpThumbStyle", slider.TickPlacement == TickPlacement.TopLeft); slider.Track.Thumb.Classes.Set("HorizontalSliderDownThumbStyle", slider.TickPlacement == TickPlacement.BottomRight); } else { slider.Track.Thumb.Classes.Set("VerticalSliderLeftThumbStyle", slider.TickPlacement == TickPlacement.TopLeft); slider.Track.Thumb.Classes.Set("VerticalSliderRightThumbStyle", slider.TickPlacement == TickPlacement.BottomRight); } TickPlacement tickBarPlacement = (TickPlacement)e.NewValue; switch (tickBarPlacement) { case TickPlacement.None: slider.TopTickBar.IsVisible = false; slider.BottomTickBar.IsVisible = false; break; case TickPlacement.TopLeft: slider.TopTickBar.IsVisible = true; if (slider.Orientation == Orientation.Horizontal) { slider.TrackBackground.Margin = new Thickness(5, 2, 5, 0); } else { slider.TrackBackground.Margin = new Thickness(2, 5, 0, 5); } break; case TickPlacement.BottomRight: slider.BottomTickBar.IsVisible = true; if (slider.Orientation == Orientation.Horizontal) { slider.TrackBackground.Margin = new Thickness(5, 2, 5, 0); } else { slider.TrackBackground.Margin = new Thickness(0, 5, 2, 5); } break; case TickPlacement.Both: slider.TopTickBar.IsVisible = true; slider.BottomTickBar.IsVisible = true; break; } }
public static IntPtr Box_TickPlacement(TickPlacement val) { IntPtr ret = NoesisGUI_PINVOKE.Box_TickPlacement((int)val); return(ret); }
public static TickPlacement Unbox_TickPlacement(IntPtr val) { TickPlacement ret = (TickPlacement)NoesisGUI_PINVOKE.Unbox_TickPlacement(val); return(ret); }
private void TickPlacementLayout() { //TickPlacement TextView placementLabel = new TextView(context); placementLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center); placementLabel.Text = "Tick Placement"; placementLabel.TextSize = 15; placementLabel.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); placementLabel.SetTextColor(Color.Black); placementLabel.Gravity = GravityFlags.Left; //positionList List <String> positionList = new List <String>(); positionList.Add("BottomRight"); positionList.Add("TopLeft"); positionList.Add("Outside"); positionList.Add("Inline"); positionList.Add("None"); dataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, positionList); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); //tickSpinner tickSpinner = new Spinner(context, SpinnerMode.Dialog); tickSpinner.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center); tickSpinner.SetPadding(0, 0, 0, 0); tickSpinner.Adapter = dataAdapter; tickSpinner.SetSelection(tickPosition); tickSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem(e.Position); tickPosition = e.Position; if (selectedItem.Equals("BottomRight")) { tickplacement = TickPlacement.BottomRight; } else if (selectedItem.Equals("TopLeft")) { tickplacement = TickPlacement.TopLeft; } else if (selectedItem.Equals("Inline")) { tickplacement = TickPlacement.Inline; } else if (selectedItem.Equals("Outside")) { tickplacement = TickPlacement.Outside; } else if (selectedItem.Equals("None")) { tickplacement = TickPlacement.None; } ApplyChanges(); }; //tickPlacementLayout LinearLayout tickPlacementLayout = new LinearLayout(context); tickPlacementLayout.Orientation = Android.Widget.Orientation.Horizontal; tickPlacementLayout.AddView(placementLabel); tickPlacementLayout.AddView(tickSpinner); proprtyOptionsLayout.AddView(tickPlacementLayout); //spaceText TextView spaceText2 = new TextView(context); spaceText2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 40, GravityFlags.Center); proprtyOptionsLayout.AddView(spaceText2); }
private void TickPlacementLayout() { propertylayout = new LinearLayout(context); propertylayout.Orientation = droid.Vertical; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width * 2, 5); layoutParams.SetMargins(0, 5, 0, 0); //TICK PLACEMENT TextView placementLabel = new TextView(context); placementLabel.Text = " " + "Tick Placement"; placementLabel.TextSize = 20; placementLabel.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); placementLabel.SetTextColor(Color.Black); placementLabel.Gravity = GravityFlags.Left; TextView adjLabel2 = new TextView(context); adjLabel2.SetHeight(14); propertylayout.AddView(adjLabel2); //tickSpinner tickSpinner = new Spinner(context, SpinnerMode.Dialog); tickSpinner.SetPadding(0, 0, 0, 0); propertylayout.AddView(placementLabel); SeparatorView separate = new SeparatorView(context, width * 2); separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); //propertylayout.AddView(separate, layoutParams); TextView adjLabel3 = new TextView(context); adjLabel3.SetHeight(20); //propertylayout.AddView(adjLabel3); propertylayout.AddView(tickSpinner); TextView adjLabel4 = new TextView(context); propertylayout.AddView(adjLabel4); //positionList List <String> positionList = new List <String>(); positionList.Add("BottomRight"); positionList.Add("TopLeft"); positionList.Add("Outside"); positionList.Add("Inline"); positionList.Add("None"); //dataAdapter dataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, positionList); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); //tickSpinner tickSpinner.Adapter = dataAdapter; tickSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem(e.Position); if (selectedItem.Equals("BottomRight")) { tickplacement = TickPlacement.BottomRight; } else if (selectedItem.Equals("TopLeft")) { tickplacement = TickPlacement.TopLeft; } else if (selectedItem.Equals("Inline")) { tickplacement = TickPlacement.Inline; } else if (selectedItem.Equals("Outside")) { tickplacement = TickPlacement.Outside; } else if (selectedItem.Equals("None")) { tickplacement = TickPlacement.None; } }; }
public override View GetPropertyWindowLayout(Android.Content.Context context) { int width = context.Resources.DisplayMetrics.WidthPixels / 2; propertylayout = new LinearLayout(context); propertylayout.Orientation = droid.Vertical; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( width * 2, 5); layoutParams.SetMargins(0, 5, 0, 0); TextView textView1 = new TextView(context); textView1.Text = " " + "TICK PLACEMENT"; textView1.TextSize = 15; textView1.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView1.SetTextColor(Color.White); textView1.Gravity = GravityFlags.Left; TextView textview2 = new TextView(context); textview2.SetHeight(14); propertylayout.AddView(textview2); tickSpinner = new Spinner(context); tickSpinner.SetPadding(0, 0, 0, 0); propertylayout.AddView(textView1); SeparatorView separate = new SeparatorView(context, width * 2); separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); propertylayout.AddView(separate, layoutParams); TextView textview8 = new TextView(context); textview8.SetHeight(20); propertylayout.AddView(textview8); propertylayout.AddView(tickSpinner); TextView textview3 = new TextView(context); propertylayout.AddView(textview3); List <String> list = new List <String> (); list.Add("BottomRight"); list.Add("TopLeft"); list.Add("Outside"); list.Add("Inline"); list.Add("None"); dataAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, list); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); tickSpinner.Adapter = dataAdapter; tickSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem(e.Position); if (selectedItem.Equals("BottomRight")) { tickplacement = TickPlacement.BottomRight; } else if (selectedItem.Equals("TopLeft")) { tickplacement = TickPlacement.TopLeft; } else if (selectedItem.Equals("Inline")) { tickplacement = TickPlacement.Inline; } else if (selectedItem.Equals("Outside")) { tickplacement = TickPlacement.Outside; } else if (selectedItem.Equals("None")) { tickplacement = TickPlacement.None; } }; TextView textView3 = new TextView(context); textView3.Text = " " + "LABEL PLACEMENT"; textView3.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView3.Gravity = GravityFlags.Left; textView3.TextSize = 15; textView3.SetTextColor(Color.White); List <String> labelList = new List <String> (); labelList.Add("BottomRight"); labelList.Add("TopLeft"); labelSpinner = new Spinner(context); labelSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem(e.Position); if (selectedItem.Equals("TopLeft")) { valueplacement = ValuePlacement.TopLeft; } else if (selectedItem.Equals("BottomRight")) { valueplacement = ValuePlacement.BottomRight; } }; labelAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, labelList); labelAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); labelSpinner.Adapter = labelAdapter; labelSpinner.SetPadding(0, 0, 0, 0); LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(width * 2, 7); layoutParams2.SetMargins(0, 5, 0, 0); propertylayout.AddView(textView3); SeparatorView separate2 = new SeparatorView(context, width * 2); separate2.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 7); propertylayout.AddView(separate2, layoutParams2); TextView textview9 = new TextView(context); textview9.SetHeight(20); propertylayout.AddView(textview9); propertylayout.AddView(labelSpinner); propertylayout.SetPadding(15, 0, 15, 0); TextView textview7 = new TextView(context); textview7.SetHeight(20); propertylayout.AddView(textview7); TextView textView6 = new TextView(context); textView6.Text = " " + "Show Label"; textView6.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView6.Gravity = GravityFlags.Center; textView6.TextSize = 16; Switch checkBox = new Switch(context); checkBox.Checked = true; checkBox.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => { if (e.IsChecked) { showlabel = true; } else { showlabel = false; } }; LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams3.SetMargins(0, 10, 0, 0); LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, 55); layoutParams4.SetMargins(0, 10, 0, 0); stackView3 = new LinearLayout(context); stackView3.AddView(textView6, layoutParams4); stackView3.AddView(checkBox, layoutParams3); stackView3.Orientation = droid.Horizontal; propertylayout.AddView(stackView3); SeparatorView separate3 = new SeparatorView(context, width * 2); separate3.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams( width * 2, 5); layoutParams7.SetMargins(0, 30, 0, 0); propertylayout.AddView(separate3, layoutParams7); TextView textView7 = new TextView(context); textView7.Text = " " + "SnapsToTicks"; textView7.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView7.Gravity = GravityFlags.Center; textView7.TextSize = 16; Switch checkBox2 = new Switch(context); checkBox2.Checked = false; checkBox2.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => { if (e.IsChecked) { snapsto = SnapsTo.Ticks; } else { snapsto = SnapsTo.None; } }; LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams5.SetMargins(0, 20, 0, 0); LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, 55); layoutParams6.SetMargins(0, 20, 0, 0); stackView4 = new LinearLayout(context); stackView4.AddView(textView7, layoutParams6); stackView4.AddView(checkBox2, layoutParams5); stackView4.Orientation = droid.Horizontal; propertylayout.AddView(stackView4); SeparatorView separate4 = new SeparatorView(context, width * 2); separate4.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams( width * 2, 5); layoutParams8.SetMargins(0, 30, 0, 0); propertylayout.AddView(separate4, layoutParams8); return(propertylayout); }
public override View GetPropertyWindowLayout (Android.Content.Context context) { int width = context.Resources.DisplayMetrics.WidthPixels / 2; propertylayout = new LinearLayout (context); propertylayout.Orientation = droid.Vertical; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams ( width * 2, 5); layoutParams.SetMargins (0, 5, 0, 0); TextView textView1 = new TextView (context); textView1.Text = " " + "TICK PLACEMENT"; textView1.TextSize = 15; textView1.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView1.SetTextColor (Color.White); textView1.Gravity = GravityFlags.Left; TextView textview2 = new TextView (context); textview2.SetHeight (14); propertylayout.AddView (textview2); tickSpinner = new Spinner (context); tickSpinner.SetPadding (0, 0, 0, 0); propertylayout.AddView (textView1); SeparatorView separate = new SeparatorView (context, width * 2); separate.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 5); propertylayout.AddView (separate, layoutParams); TextView textview8 = new TextView (context); textview8.SetHeight (20); propertylayout.AddView (textview8); propertylayout.AddView (tickSpinner); TextView textview3 = new TextView (context); propertylayout.AddView (textview3); List<String> list = new List<String> (); list.Add ("BottomRight"); list.Add ("TopLeft"); list.Add ("Outside"); list.Add ("Inline"); list.Add ("None"); dataAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, list); dataAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); tickSpinner.Adapter = dataAdapter; tickSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem (e.Position); if (selectedItem.Equals ("BottomRight")) { tickplacement = TickPlacement.BottomRight; } else if (selectedItem.Equals ("TopLeft")) { tickplacement = TickPlacement.TopLeft; } else if (selectedItem.Equals ("Inline")) { tickplacement = TickPlacement.Inline; } else if (selectedItem.Equals ("Outside")) { tickplacement = TickPlacement.Outside; } else if (selectedItem.Equals ("None")) { tickplacement = TickPlacement.None; } }; TextView textView3 = new TextView (context); textView3.Text = " " + "LABEL PLACEMENT"; textView3.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView3.Gravity = GravityFlags.Left; textView3.TextSize = 15; textView3.SetTextColor (Color.White); List<String> labelList = new List<String> (); labelList.Add ("BottomRight"); labelList.Add ("TopLeft"); labelSpinner = new Spinner (context); labelSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem (e.Position); if (selectedItem.Equals ("TopLeft")) { valueplacement = ValuePlacement.TopLeft; } else if (selectedItem.Equals ("BottomRight")) { valueplacement = ValuePlacement.BottomRight; } }; labelAdapter = new ArrayAdapter<String> (context, Android.Resource.Layout.SimpleSpinnerItem, labelList); labelAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem); labelSpinner.Adapter = labelAdapter; labelSpinner.SetPadding (0, 0, 0, 0); LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams (width * 2, 7); layoutParams2.SetMargins (0, 5, 0, 0); propertylayout.AddView (textView3); SeparatorView separate2 = new SeparatorView (context, width * 2); separate2.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 7); propertylayout.AddView (separate2, layoutParams2); TextView textview9 = new TextView (context); textview9.SetHeight (20); propertylayout.AddView (textview9); propertylayout.AddView (labelSpinner); propertylayout.SetPadding (15, 0, 15, 0); TextView textview7 = new TextView (context); textview7.SetHeight (20); propertylayout.AddView (textview7); TextView textView6 = new TextView (context); textView6.Text = " " + "Show Label"; textView6.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView6.Gravity = GravityFlags.Center; textView6.TextSize = 16; Switch checkBox = new Switch (context); checkBox.Checked = true; checkBox.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => { if (e.IsChecked) showlabel = true; else showlabel = false; }; LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams ( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams3.SetMargins (0, 10, 0, 0); LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams ( ViewGroup.LayoutParams.WrapContent, 55); layoutParams4.SetMargins (0, 10, 0, 0); stackView3 = new LinearLayout (context); stackView3.AddView (textView6, layoutParams4); stackView3.AddView (checkBox, layoutParams3); stackView3.Orientation = droid.Horizontal; propertylayout.AddView (stackView3); SeparatorView separate3 = new SeparatorView (context, width * 2); separate3.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 5); LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams ( width * 2, 5); layoutParams7.SetMargins (0, 30, 0, 0); propertylayout.AddView (separate3, layoutParams7); TextView textView7 = new TextView (context); textView7.Text = " "+"SnapsToTicks"; textView7.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView7.Gravity = GravityFlags.Center; textView7.TextSize = 16; Switch checkBox2 = new Switch (context); checkBox2.Checked = false; checkBox2.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => { if (e.IsChecked) snapsto = SnapsTo.Ticks; else snapsto = SnapsTo.None; }; LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams ( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams5.SetMargins (0, 20, 0, 0); LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams ( ViewGroup.LayoutParams.WrapContent, 55); layoutParams6.SetMargins (0, 20, 0, 0); stackView4 = new LinearLayout (context); stackView4.AddView (textView7, layoutParams6); stackView4.AddView (checkBox2, layoutParams5); stackView4.Orientation = droid.Horizontal; propertylayout.AddView (stackView4); SeparatorView separate4 = new SeparatorView (context, width * 2); separate4.LayoutParameters = new ViewGroup.LayoutParams (width * 2, 5); LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams ( width * 2, 5); layoutParams8.SetMargins (0, 30, 0, 0); propertylayout.AddView (separate4, layoutParams8); return propertylayout; }