public Page1() { //button.Clicked += OnButtonClicked; var grid = new Grid { RowDefinitions = { new RowDefinition { Height = GridLength.Star }, new RowDefinition { Height = GridLength.Star }, new RowDefinition { Height = GridLength.Star }, } }; //grid.Children.Add(new SkiaObject()); //grid.Children.Add(button, 0, 1); //grid.Children.Add(new Forms9Patch.Label { Text = "pizza" }, 0, 2); grid.Children.Add(label, 0, 1); listener = FormsGestures.Listener.For(label); Content = grid; }
void SetupTouchEvents(FormsGestures.Listener listener) { listener.Down += ShowTouch; listener.Up += ShowTouch; listener.Tapping += ShowTouch; listener.Tapped += ShowTouch; listener.DoubleTapped += ShowTouch; listener.LongPressing += ShowTouch; listener.LongPressed += ShowTouch; }
protected virtual void Dispose(bool disposing) { if (!_disposed) { _disposed = true; if (disposing) { //button.Clicked -= OnButtonClicked; listener?.Dispose(); listener = null; } } }
protected override void OnAppearing() { base.OnAppearing(); GC.Collect(); //System.Diagnostics.Debug.WriteLine("Page1.OnAppearing: " + GC.GetTotalMemory(true).ToString("n")); Device.StartTimer(TimeSpan.FromSeconds(1), () => { Navigation.PopAsync(); // the following results in no leak! listener.Dispose(); listener = null; return(false); }); }
public GesturesTestPage() { var button = new Button { BackgroundColor = Color.Pink, Text = "Hello", BorderColor = Color.Blue, BorderWidth = 3, }; button.Clicked += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBUTTON CLICKED!!!!"); var buttonListener = new FormsGestures.Listener(button); buttonListener.Down += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER DOWN"); // does not work with UIControl derived elements buttonListener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER LONG PRESSING"); buttonListener.Panning += (sender, e) => { button.TranslationX += e.DeltaDistance.X; button.TranslationY += e.DeltaDistance.Y; }; buttonListener.Pinching += (sender, e) => { button.Scale *= e.DeltaScale; }; buttonListener.Rotating += (sender, e) => { button.Rotation += e.DeltaAngle; }; buttonListener.Up += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER UP"); // does not work with UIControl derived elements buttonListener.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER TAPPED"); // does not work with UIControl derived elements buttonListener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER DOUBLE TAPPED"); // does not work with UIControl derived elements buttonListener.LongPressed += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER LONG PRESSED"); buttonListener.Panned += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER PANNED"); buttonListener.Swiped += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER SWIPED!!!"); buttonListener.Pinched += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER PINCHED"); buttonListener.Rotated += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tLISTENER ROTATED"); var box = new BoxView { BackgroundColor = Color.Green, }; var boxListener = new FormsGestures.Listener (box); boxListener.Down += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX DOWN"); boxListener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX LONG PRESSING"); boxListener.Panning += (sender, e) => { box.TranslationX += e.DeltaDistance.X; box.TranslationY += e.DeltaDistance.Y; }; boxListener.Pinching += (sender, e) => { System.Diagnostics.Debug.WriteLine("\tBOX PINCHEING [" + e.DeltaScale + "]"); box.Scale *= e.DeltaScale; }; boxListener.Rotating += (sender, e) => { System.Diagnostics.Debug.WriteLine("\tBOX ROTATING ["+e.DeltaAngle+"]"); box.Rotation += e.DeltaAngle; }; boxListener.Up += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX UP"); boxListener.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX TAPPED"); boxListener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX DOUBLE TAPPED"); boxListener.LongPressed += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX LONG PRESSED"); boxListener.Panned += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX PANNED"); boxListener.Swiped += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX SWIPED!!!"); boxListener.Pinched += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX PINCHED"); boxListener.Rotated += (sender, e) => System.Diagnostics.Debug.WriteLine ("\tBOX ROTATED"); relativeLayout = new Xamarin.Forms.RelativeLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0), BackgroundColor = Color.Transparent, }; relativeLayout.Children.Clear (); relativeLayout.Children.Add(button, xConstraint: Constraint.RelativeToParent ((parent) => { return parent.X + parent.Width/2;}), yConstraint: Constraint.RelativeToParent ((parent) => { return parent.Y + parent.Height/2;}), widthConstraint: Constraint.RelativeToParent ((parent) => { return parent.Width/8;}), heightConstraint: Constraint.RelativeToParent ((parent) => { return parent.Height/10;}) ); relativeLayout.Children.Add(box, xConstraint: Constraint.RelativeToParent ((parent) => { return parent.X + parent.Width/4;}), yConstraint: Constraint.RelativeToParent ((parent) => { return parent.Y + parent.Height/4;}), widthConstraint: Constraint.RelativeToParent ((parent) => { return parent.Width/8;}), heightConstraint: Constraint.RelativeToParent ((parent) => { return parent.Height/10;}) ); absoluteLayout = new Xamarin.Forms.AbsoluteLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, // Padding = new Thickness(5, Device.OnPlatform(20, 0, 0), 5, 5), Padding = new Thickness(5,5,5,5), // given tool bar don't need upper padding BackgroundColor = Color.White }; absoluteLayout.Children.Add ( relativeLayout, new Rectangle(0,0,1,1), AbsoluteLayoutFlags.All ); Content = absoluteLayout; }
public EllipticalMaterialButtonsPage() { var infoIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info"); var arrowIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.ArrowR"); #region Material Buttons var grid = new Grid { RowDefinitions = { new RowDefinition { Height = GridLength.Auto } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; var mb1 = new Forms9Patch.MaterialButton { Text = "", ImageSource = arrowIcon, IsElliptical = true }; mb1.Tapped += OnMaterialButtonTapped; mb1.Selected += OnMaterialButtonSelected; mb1.LongPressing += OnMaterialButtonLongPressing; mb1.LongPressed += OnMaterialButtonLongPressed; var mb2 = new Forms9Patch.MaterialButton { //Text = "toggle", ToggleBehavior = true, ImageSource = infoIcon, IsElliptical = true, }; mb2.Tapped += OnMaterialButtonTapped; mb2.Selected += OnMaterialButtonSelected; mb2.LongPressing += OnMaterialButtonLongPressing; mb2.LongPressed += OnMaterialButtonLongPressed; var mb3 = new Forms9Patch.MaterialButton { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, ImageSource = arrowIcon, IsElliptical = true }; mb3.Tapped += OnMaterialButtonTapped; mb3.Selected += OnMaterialButtonSelected; mb3.LongPressing += OnMaterialButtonLongPressing; mb3.LongPressed += OnMaterialButtonLongPressed; var mb4 = new Forms9Patch.MaterialButton { //Text = "selected disabled", IsEnabled = false, IsSelected = true, ImageSource = infoIcon, IsElliptical = true }; mb4.Tapped += OnMaterialButtonTapped; mb4.Selected += OnMaterialButtonSelected; mb4.LongPressing += OnMaterialButtonLongPressing; mb4.LongPressed += OnMaterialButtonLongPressed; var label1 = new Label { Text = "Gesture Label", BackgroundColor = Color.Blue, HeightRequest = 50 }; var label1Listener = new FormsGestures.Listener (label1); label1Listener.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"Tapped:{((Label)sender).Text}"); label1Listener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"DoubleTapped:{((Label)sender).Text}"); label1Listener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine($"LongPressing:{((Label)sender).Text}"); // How to remove a listener! label1Listener.LongPressed += (sender, e) => { label1Listener.Dispose(); System.Diagnostics.Debug.WriteLine("Removed FormsGestures.Listener"); }; grid.Children.Add (new StackLayout { BackgroundColor = Color.FromHex("#33FF33"), Padding = new Thickness(10), Children = { new Label { Text = "Default, Light", TextColor = Color.Black }, mb1,mb2, mb3, mb4, new Label { Text = "Outline, Light", TextColor = Color.Black }, new Forms9Patch.MaterialButton { Text = "", ImageSource = arrowIcon, OutlineWidth = 0, IsElliptical = true }, new Forms9Patch.MaterialButton { //Text = "toggle", ToggleBehavior = true, ImageSource = infoIcon, OutlineWidth = 0, IsElliptical = true }, new Forms9Patch.MaterialButton { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, ImageSource = arrowIcon, OutlineWidth = 0, IsElliptical = true }, new Forms9Patch.MaterialButton { //Text = "selected disabled", IsEnabled = false, IsSelected = true, ImageSource = infoIcon, OutlineWidth = 0, IsElliptical = true }, new Label { Text = "Background Color, Light Theme", TextColor = Color.Black }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = infoIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = arrowIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = infoIcon, IsElliptical = true }, new Label { Text = "Shadow, Light Theme", TextColor = Color.Black }, new Forms9Patch.MaterialButton { Text = "default", HasShadow = true, ImageSource = infoIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, HasShadow = true, ImageSource = arrowIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, HasShadow = true, ImageSource = infoIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, HasShadow = true, ImageSource = arrowIcon, IsElliptical = true }, new Label { Text = "Shadow Background Color, Light Theme", TextColor = Color.Black }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = infoIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = arrowIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = infoIcon, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = arrowIcon, IsElliptical = true }, }, }, 0, 0); grid.Children.Add(new StackLayout { Padding = new Thickness(10), BackgroundColor = Color.FromHex("#003"), Children = { new Label { Text = "Default, Dark Theme", TextColor = Color.White }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, DarkTheme = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, IsElliptical = true }, new Label { Text = "Outline, Dark Theme", TextColor = Color.White }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, OutlineWidth = 0, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, DarkTheme = true, OutlineWidth = 0, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, OutlineWidth = 0, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, OutlineWidth = 0, IsElliptical = true }, new Label { Text = "Background Color, Dark Theme", TextColor = Color.White }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, IsElliptical = true }, new Label { Text = "Shadow, Dark Theme", TextColor = Color.White }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, HasShadow = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, DarkTheme = true, HasShadow = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, HasShadow = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, HasShadow = true, IsElliptical = true }, new Label { Text = "Shadow Background Color, Dark Theme", TextColor = Color.White }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, IsElliptical = true }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, IsElliptical = true }, }, },1,0); #endregion Padding = 20; Content = new ScrollView { Content = new StackLayout{ Children = { grid, }, }, }; }
public MaterialButtonsPage() { var infoIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info"); var arrowIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.ArrowR"); #region Material Buttons var grid = new Grid { RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, }; var mb1 = new Forms9Patch.MaterialButton { Text = "", ImageSource = arrowIcon, }; mb1.Tapped += OnMaterialButtonTapped; mb1.Selected += OnMaterialButtonSelected; mb1.LongPressing += OnMaterialButtonLongPressing; mb1.LongPressed += OnMaterialButtonLongPressed; var mb2 = new Forms9Patch.MaterialButton { //Text = "sticky", StickyBehavior = true, ImageSource = infoIcon, }; mb2.Tapped += OnMaterialButtonTapped; mb2.Selected += OnMaterialButtonSelected; mb2.LongPressing += OnMaterialButtonLongPressing; mb2.LongPressed += OnMaterialButtonLongPressed; var mb3 = new Forms9Patch.MaterialButton { //Text = "disabled", StickyBehavior = true, IsEnabled = false, ImageSource = arrowIcon, }; mb3.Tapped += OnMaterialButtonTapped; mb3.Selected += OnMaterialButtonSelected; mb3.LongPressing += OnMaterialButtonLongPressing; mb3.LongPressed += OnMaterialButtonLongPressed; var mb4 = new Forms9Patch.MaterialButton { //Text = "selected disabled", IsEnabled = false, IsSelected = true, ImageSource = infoIcon, }; mb4.Tapped += OnMaterialButtonTapped; mb4.Selected += OnMaterialButtonSelected; mb4.LongPressing += OnMaterialButtonLongPressing; mb4.LongPressed += OnMaterialButtonLongPressed; var label1 = new Label { Text = "Gesture Label", BackgroundColor = Color.Blue, HeightRequest = 50, }; var label1Listener = new FormsGestures.Listener(label1); label1Listener.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"Tapped:{((Label)sender).Text}"); label1Listener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"DoubleTapped:{((Label)sender).Text}"); label1Listener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine($"LongPressing:{((Label)sender).Text}"); // How to remove a listener! label1Listener.LongPressed += (sender, e) => { label1Listener.Dispose(); System.Diagnostics.Debug.WriteLine("Removed FormsGestures.Listener"); }; grid.Children.Add(new StackLayout { BackgroundColor = Color.FromHex("#33FF33"), Padding = new Thickness(10), Children = { new Label { Text = "Default, Light", TextColor = Color.Black, }, mb1, mb2, mb3, mb4, new Label { Text = "Outline, Light", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "", ImageSource = arrowIcon, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { //Text = "sticky", StickyBehavior = true, ImageSource = infoIcon, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { //Text = "disabled", StickyBehavior = true, IsEnabled = false, ImageSource = arrowIcon, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { //Text = "selected disabled", IsEnabled = false, IsSelected = true, ImageSource = infoIcon, OutlineWidth = 0, }, new Label { Text = "Background Color, Light Theme", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = arrowIcon, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = infoIcon, }, new Label { Text = "Shadow, Light Theme", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "default", HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, HasShadow = true, ImageSource = arrowIcon, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, HasShadow = true, ImageSource = arrowIcon, }, new Label { Text = "Shadow Background Color, Light Theme", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = arrowIcon, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = arrowIcon, }, }, }, 0, 0); grid.Children.Add(new StackLayout { Padding = new Thickness(10), BackgroundColor = Color.FromHex("#003"), Children = { new Label { Text = "Default, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, }, new Label { Text = "Outline, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, OutlineWidth = 0, }, new Label { Text = "Background Color, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Label { Text = "Shadow, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, HasShadow = true, }, new Label { Text = "Shadow Background Color, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "sticky", StickyBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "disabled", StickyBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, }, }, 1, 0); #endregion #region Light SegmentedControl var sc1 = new Forms9Patch.MaterialSegmentedControl { Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, Command = _trueCommand, CommandParameter = "sc1 A", }, new Forms9Patch.Segment { //Text = "B", IsSelected = true, ImageSource = arrowIcon, Command = _trueCommand, CommandParameter = "sc1 B", }, new Forms9Patch.Segment { Text = "C", Command = _trueCommand, CommandParameter = "sc1 C", }, new Forms9Patch.Segment { Text = "D", //IsEnabled = false, Command = _falseCommand, CommandParameter = "sc1 D", }, }, }; sc1.SegmentSelected += OnSegmentSelected; sc1.SegmentTapped += OnSegmentTapped; sc1.SegmentLongPressing += OnSegmentLongPressing; sc1.SegmentLongPressed += OnSegmentLongPressed; var seg1 = new Forms9Patch.Segment { //Text = "A", ImageSource = arrowIcon, }; seg1.Tapped += OnMaterialButtonTapped; seg1.Selected += OnMaterialButtonTapped; seg1.LongPressing += OnMaterialButtonLongPressing; seg1.LongPressed += OnMaterialButtonLongPressed; var seg2 = new Forms9Patch.Segment { Text = "B", IsSelected = true, }; seg2.Tapped += OnMaterialButtonTapped; seg2.Selected += OnMaterialButtonTapped; seg2.LongPressing += OnMaterialButtonLongPressing; seg2.LongPressed += OnMaterialButtonLongPressed; var seg3 = new Forms9Patch.Segment { Text = "C", }; seg3.Tapped += OnMaterialButtonTapped; seg3.Selected += OnMaterialButtonTapped; seg3.LongPressing += OnMaterialButtonLongPressing; seg3.LongPressed += OnMaterialButtonLongPressed; var seg4 = new Forms9Patch.Segment { Text = "D", IsEnabled = false, }; seg4.Tapped += OnMaterialButtonTapped; seg4.Selected += OnMaterialButtonTapped; seg4.LongPressing += OnMaterialButtonLongPressing; seg4.LongPressed += OnMaterialButtonLongPressed; var sc2 = new Forms9Patch.MaterialSegmentedControl { OutlineWidth = 0, Segments = { seg1, seg2, seg3, seg4, }, }; sc2.SegmentSelected += OnSegmentSelected; sc2.SegmentTapped += OnSegmentTapped; sc2.SegmentLongPressing += OnSegmentLongPressing; sc2.SegmentLongPressed += OnSegmentLongPressed; var sc3 = new Forms9Patch.MaterialSegmentedControl { //OutlineColor = Color.Transparent, BackgroundColor = Color.FromHex("#E0E0E0"), Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { //Text = "D", IsEnabled = false, ImageSource = arrowIcon, }, }, }; sc3.SegmentSelected += OnSegmentSelected; sc3.SegmentTapped += OnSegmentTapped; sc3.SegmentLongPressing += OnSegmentLongPressing; sc3.SegmentLongPressed += OnSegmentLongPressed; var sc4 = new Forms9Patch.MaterialSegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), OutlineWidth = 0, SeparatorWidth = 1, StickyBehavior = Forms9Patch.SegmentControlStickyBehavior.None, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, }, }; sc4.SegmentSelected += OnSegmentSelected; sc4.SegmentTapped += OnSegmentTapped; sc4.SegmentLongPressing += OnSegmentLongPressing; sc4.SegmentLongPressed += OnSegmentLongPressed; var sc5 = new Forms9Patch.MaterialSegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, //OutlineRadius = 0, //OutlineWidth = 0, Orientation = StackOrientation.Vertical, StickyBehavior = Forms9Patch.SegmentControlStickyBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }; sc5.SegmentSelected += OnSegmentSelected; sc5.SegmentTapped += OnSegmentTapped; sc5.SegmentLongPressing += OnSegmentLongPressing; sc5.SegmentLongPressed += OnSegmentLongPressed; var sc6 = new Forms9Patch.MaterialSegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, //OutlineRadius = 0, OutlineWidth = 0, SeparatorWidth = 1, Orientation = StackOrientation.Vertical, StickyBehavior = Forms9Patch.SegmentControlStickyBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = arrowIcon, //Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }; sc6.SegmentSelected += OnSegmentSelected; sc6.SegmentTapped += OnSegmentTapped; sc6.SegmentLongPressing += OnSegmentLongPressing; sc6.SegmentLongPressed += OnSegmentLongPressed; #endregion Padding = 20; Content = new ScrollView { Content = new StackLayout { Children = { grid, #region MaterialSegmentControl new StackLayout { Orientation = StackOrientation.Horizontal, Children = { #region Light new StackLayout { BackgroundColor = Color.Lime, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10), Children = { new Label { Text = "Default, Light", TextColor = Color.Black, }, sc1,sc2, sc3, sc4, sc5, sc6, }, }, #endregion #region Dark new StackLayout { BackgroundColor = Color.FromHex("#003"), HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10), Children = { new Label { Text = "Default, Dark", TextColor = Color.White, }, new Forms9Patch.MaterialSegmentedControl { //OutlineColor = Color.Transparent, DarkTheme = true, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { //Text = "B", IsSelected = true, ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, OutlineWidth = 0, Segments = { new Forms9Patch.Segment { //Text = "A", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { //Text = "D", IsEnabled = false, ImageSource = arrowIcon, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), OutlineWidth = 0, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), HasShadow = true, //OutlineRadius = 0, //OutlineWidth = 0, Orientation = StackOrientation.Vertical, StickyBehavior = Forms9Patch.SegmentControlStickyBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), HasShadow = true, //OutlineRadius = 0, OutlineWidth = 0, SeparatorWidth = 1, Orientation = StackOrientation.Vertical, StickyBehavior = Forms9Patch.SegmentControlStickyBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, }, }, #endregion }, }, #endregion }, }, }; }
public MaterialButtonsPage() { var infoIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.Info"); var arrowIcon = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.ArrowR"); #region Material Buttons var grid = new Grid { RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, }; var mb1 = new Forms9Patch.MaterialButton { Text = "", ImageSource = arrowIcon, }; mb1.Tapped += OnMaterialButtonTapped; mb1.Selected += OnMaterialButtonSelected; mb1.LongPressing += OnMaterialButtonLongPressing; mb1.LongPressed += OnMaterialButtonLongPressed; var mb2 = new Forms9Patch.MaterialButton { //Text = "toggle", ToggleBehavior = true, ImageSource = infoIcon, }; mb2.Tapped += OnMaterialButtonTapped; mb2.Selected += OnMaterialButtonSelected; mb2.LongPressing += OnMaterialButtonLongPressing; mb2.LongPressed += OnMaterialButtonLongPressed; var mb3 = new Forms9Patch.MaterialButton { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, ImageSource = arrowIcon, }; mb3.Tapped += OnMaterialButtonTapped; mb3.Selected += OnMaterialButtonSelected; mb3.LongPressing += OnMaterialButtonLongPressing; mb3.LongPressed += OnMaterialButtonLongPressed; var mb4 = new Forms9Patch.MaterialButton { //Text = "selected disabled", IsEnabled = false, IsSelected = true, ImageSource = infoIcon, }; mb4.Tapped += OnMaterialButtonTapped; mb4.Selected += OnMaterialButtonSelected; mb4.LongPressing += OnMaterialButtonLongPressing; mb4.LongPressed += OnMaterialButtonLongPressed; var label1 = new Label { Text = "Gesture Label", BackgroundColor = Color.Blue, HeightRequest = 50, }; var label1Listener = new FormsGestures.Listener (label1); label1Listener.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"Tapped:{((Label)sender).Text}"); label1Listener.DoubleTapped += (sender, e) => System.Diagnostics.Debug.WriteLine($"DoubleTapped:{((Label)sender).Text}"); label1Listener.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine($"LongPressing:{((Label)sender).Text}"); // How to remove a listener! label1Listener.LongPressed += (sender, e) => { label1Listener.Dispose(); System.Diagnostics.Debug.WriteLine("Removed FormsGestures.Listener"); }; grid.Children.Add (new StackLayout { BackgroundColor = Color.FromHex("#33FF33"), Padding = new Thickness(10), Children = { new Label { Text = "Default, Light", TextColor = Color.Black, }, mb1,mb2, mb3, mb4, new Label { Text = "Outline, Light", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "", ImageSource = arrowIcon, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { //Text = "toggle", ToggleBehavior = true, ImageSource = infoIcon, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, ImageSource = arrowIcon, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { //Text = "selected disabled", IsEnabled = false, IsSelected = true, ImageSource = infoIcon, OutlineWidth = 0, }, new Label { Text = "Background Color, Light Theme", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = arrowIcon, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), ImageSource = infoIcon, }, new Label { Text = "Shadow, Light Theme", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "default", HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, HasShadow = true, ImageSource = arrowIcon, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, HasShadow = true, ImageSource = arrowIcon, }, new Label { Text = "Shadow Background Color, Light Theme", TextColor = Color.Black, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = arrowIcon, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = infoIcon, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, ImageSource = arrowIcon, }, }, }, 0, 0); grid.Children.Add(new StackLayout { Padding = new Thickness(10), BackgroundColor = Color.FromHex("#003"), Children = { new Label { Text = "Default, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, }, new Label { Text = "Outline, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, OutlineWidth = 0, }, new Label { Text = "Background Color, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Label { Text = "Shadow, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, HasShadow = true, }, new Label { Text = "Shadow Background Color, Dark Theme", TextColor = Color.White, }, new Forms9Patch.MaterialButton { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.MaterialButton { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, }, },1,0); #endregion #region Light SegmentedControl var sc1 = new Forms9Patch.MaterialSegmentedControl { Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, Command = _trueCommand, CommandParameter = "sc1 A", }, new Forms9Patch.Segment { //Text = "B", IsSelected = true, ImageSource = arrowIcon, Command = _trueCommand, CommandParameter = "sc1 B", }, new Forms9Patch.Segment { Text = "C", Command = _trueCommand, CommandParameter = "sc1 C", }, new Forms9Patch.Segment { Text = "D", //IsEnabled = false, Command = _falseCommand, CommandParameter = "sc1 D", }, }, }; sc1.SegmentSelected += OnSegmentSelected; sc1.SegmentTapped += OnSegmentTapped; sc1.SegmentLongPressing += OnSegmentLongPressing; sc1.SegmentLongPressed += OnSegmentLongPressed; var seg1 = new Forms9Patch.Segment { //Text = "A", ImageSource = arrowIcon, }; seg1.Tapped += OnMaterialButtonTapped; seg1.Selected += OnMaterialButtonTapped; seg1.LongPressing += OnMaterialButtonLongPressing; seg1.LongPressed += OnMaterialButtonLongPressed; var seg2 = new Forms9Patch.Segment { Text = "B", IsSelected = true, }; seg2.Tapped += OnMaterialButtonTapped; seg2.Selected += OnMaterialButtonTapped; seg2.LongPressing += OnMaterialButtonLongPressing; seg2.LongPressed += OnMaterialButtonLongPressed; var seg3 = new Forms9Patch.Segment { Text = "C", }; seg3.Tapped += OnMaterialButtonTapped; seg3.Selected += OnMaterialButtonTapped; seg3.LongPressing += OnMaterialButtonLongPressing; seg3.LongPressed += OnMaterialButtonLongPressed; var seg4 = new Forms9Patch.Segment { Text = "D", IsEnabled = false, }; seg4.Tapped += OnMaterialButtonTapped; seg4.Selected += OnMaterialButtonTapped; seg4.LongPressing += OnMaterialButtonLongPressing; seg4.LongPressed += OnMaterialButtonLongPressed; var sc2 = new Forms9Patch.MaterialSegmentedControl { OutlineWidth = 0, Segments = { seg1, seg2, seg3, seg4, }, }; sc2.SegmentSelected += OnSegmentSelected; sc2.SegmentTapped += OnSegmentTapped; sc2.SegmentLongPressing += OnSegmentLongPressing; sc2.SegmentLongPressed += OnSegmentLongPressed; var sc3 = new Forms9Patch.MaterialSegmentedControl { //OutlineColor = Color.Transparent, BackgroundColor = Color.FromHex("#E0E0E0"), Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { //Text = "D", IsEnabled = false, ImageSource = arrowIcon, }, }, }; sc3.SegmentSelected += OnSegmentSelected; sc3.SegmentTapped += OnSegmentTapped; sc3.SegmentLongPressing += OnSegmentLongPressing; sc3.SegmentLongPressed += OnSegmentLongPressed; var sc4 = new Forms9Patch.MaterialSegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), OutlineWidth = 0, SeparatorWidth = 1, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.None, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, }, }; sc4.SegmentSelected += OnSegmentSelected; sc4.SegmentTapped += OnSegmentTapped; sc4.SegmentLongPressing += OnSegmentLongPressing; sc4.SegmentLongPressed += OnSegmentLongPressed; var sc5 = new Forms9Patch.MaterialSegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, //OutlineRadius = 0, //OutlineWidth = 0, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }; sc5.SegmentSelected += OnSegmentSelected; sc5.SegmentTapped += OnSegmentTapped; sc5.SegmentLongPressing += OnSegmentLongPressing; sc5.SegmentLongPressed += OnSegmentLongPressed; var sc6 = new Forms9Patch.MaterialSegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, //OutlineRadius = 0, OutlineWidth = 0, SeparatorWidth = 1, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = arrowIcon, //Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }; sc6.SegmentSelected += OnSegmentSelected; sc6.SegmentTapped += OnSegmentTapped; sc6.SegmentLongPressing += OnSegmentLongPressing; sc6.SegmentLongPressed += OnSegmentLongPressed; #endregion Padding = 20; Content = new ScrollView { Content = new StackLayout{ Children = { grid, #region MaterialSegmentControl //new StackLayout { // Orientation = StackOrientation.Horizontal, // Children = { #region Light new StackLayout { BackgroundColor = Color.Lime, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10), Children = { new Label { Text = "Default, Light", TextColor = Color.Black, }, sc1, sc2, sc3, sc4, sc5, sc6, }, }, #endregion #region Dark new StackLayout { BackgroundColor = Color.FromHex("#003"), HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10), Children = { new Label { Text = "Default, Dark", TextColor = Color.White, }, new Forms9Patch.MaterialSegmentedControl { //OutlineColor = Color.Transparent, DarkTheme = true, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { //Text = "B", IsSelected = true, ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, OutlineWidth = 0, Segments = { new Forms9Patch.Segment { //Text = "A", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { //Text = "D", IsEnabled = false, ImageSource = arrowIcon, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), OutlineWidth = 0, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, ImageSource = infoIcon, Orientation = StackOrientation.Vertical, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), HasShadow = true, //OutlineRadius = 0, //OutlineWidth = 0, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.MaterialSegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), HasShadow = true, //OutlineRadius = 0, OutlineWidth = 0, SeparatorWidth = 1, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, ImageSource = arrowIcon, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, }, }, #endregion // }, //}, #endregion }, }, }; }