public SegmentNavPage2() { Padding = new Thickness(5); BackgroundColor = Color.Green; // Define command for the items in the SegmentedController. var navigateCommand = new Command <Type>(async(Type pageType) => { var page = (Page)Activator.CreateInstance(pageType); await this.Navigation.PushAsync(page); }); var backCommand = new Command <Type>(async(obj) => { await this.Navigation.PopAsync(); }); var segmentControl = new Forms9Patch.MaterialSegmentedControl { Segments = { new Forms9Patch.Segment { Text = "Back", Command = backCommand }, new Forms9Patch.Segment { Text = "Page 1", Command = navigateCommand, CommandParameter = typeof(SegmentNavPage1), }, new Forms9Patch.Segment { Text = "Page 3", Command = navigateCommand, CommandParameter = typeof(SegmentNavPage3), } }, }; var layout = new StackLayout { Spacing = 10, Children = { new Label { Text = "Segment Nav Page 2" }, segmentControl, new Label { Text = "2", HorizontalOptions = LayoutOptions.Center, FontSize = 50, } } }; Content = layout; }
public SegmentNavPage2() { Padding = new Thickness(5); BackgroundColor = Color.Green; // Define command for the items in the SegmentedController. var navigateCommand = new Command<Type>(async (Type pageType) => { var page = (Page)Activator.CreateInstance(pageType); await this.Navigation.PushAsync(page); }); var backCommand = new Command<Type>(async (obj) => { await this.Navigation.PopAsync(); }); var segmentControl = new Forms9Patch.MaterialSegmentedControl { Segments = { new Forms9Patch.Segment { Text = "Back", Command = backCommand }, new Forms9Patch.Segment { Text = "Page 1", Command = navigateCommand, CommandParameter = typeof(SegmentNavPage1), }, new Forms9Patch.Segment { Text = "Page 3", Command = navigateCommand, CommandParameter = typeof(SegmentNavPage3), } }, }; var layout = new StackLayout { Spacing = 10, Children = { new Label { Text = "Segment Nav Page 2" }, segmentControl, new Label { Text = "2", HorizontalOptions = LayoutOptions.Center, FontSize = 50, } } }; Content = layout; }
public UnconstrainedLabelFitPage() { BackgroundColor = Color.Gray; Padding = 0; #region Editor var editor = new Editor { //Text = "Żorem ipsum dolor sit amet, consectetur adięiscing ełit", Text = text1, TextColor = Color.White, BackgroundColor = Color.Black, HeightRequest = 130, FontSize = 15, }; editor.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); #endregion #region Xamarin Forms label var xfLabel = new Label { FontSize = 15, TextColor = Color.White, BackgroundColor = Color.Black, Text = editor.Text }; #endregion #region Forms9Patch Label var f9pLabel = new Forms9Patch.Label { //HeightRequest = 50, Lines = 3, FontSize = 15, TextColor = Color.White, Fit = Forms9Patch.LabelFit.None, BackgroundColor = Color.Black, Text = editor.Text }; #endregion #region Mode var modeSwitch = new Switch { IsToggled = false, HorizontalOptions = LayoutOptions.End, }; modeSwitch.Toggled += (sender, e) => { if (modeSwitch.IsToggled) { f9pLabel.HtmlText = editor.Text; } else { f9pLabel.Text = editor.Text; } }; #endregion #region Sync text between Editor and Labels editor.TextChanged += (sender, e) => { xfLabel.Text = editor.Text; f9pLabel.HtmlText = editor.Text; }; #endregion #region Font Size selection var fontSizeSlider = new Slider { Maximum = 104, Minimum = 4, Value = 15 }; var fontSizeLabel = new Label { Text = "Font Size: 15" }; fontSizeSlider.ValueChanged += (sender, e) => { fontSizeLabel.Text = "Font Size: " + fontSizeSlider.Value; f9pLabel.FontSize = fontSizeSlider.Value; if (!rendering) { rendering = true; xfLabel.FontSize = fontSizeSlider.Value; Device.StartTimer(TimeSpan.FromMilliseconds(50), () => { if (Math.Abs(xfLabel.FontSize - lastFontSize) > double.Epsilon * 5) { xfLabel.FontSize = lastFontSize; return(true); } rendering = false; return(false); }); } lastFontSize = fontSizeSlider.Value; }; var actualFontSizeLabel = new Label { Text = "Actual Font Size: 15" }; f9pLabel.PropertyChanged += (sender, e) => { if (e.PropertyName == Forms9Patch.Label.ActualFontSizeProperty.PropertyName) { actualFontSizeLabel.Text = "ActualFontSize: " + f9pLabel.ActualFontSize; } }; #endregion #region Lines selection var linesLabel = new Label { Text = "Lines: 3" }; var linesSlider = new Slider { Minimum = 0, Maximum = 8, Value = 3 }; linesSlider.ValueChanged += (sender, e) => { linesLabel.Text = "Lines: " + ((int)Math.Round(linesSlider.Value)); f9pLabel.Lines = ((int)Math.Round(linesSlider.Value)); }; #endregion #region Fit Selection var fitSelector = new Forms9Patch.MaterialSegmentedControl(); fitSelector.Segments.Add(new Forms9Patch.Segment { Text = "None", Command = new Command(x => { f9pLabel.Fit = Forms9Patch.LabelFit.None; }) }); var widthSegment = new Forms9Patch.Segment { Text = "Width", Command = new Command(x => { f9pLabel.Fit = Forms9Patch.LabelFit.Width; }), //IsEnabled = f9pLabel.HasImposedSize, BindingContext = f9pLabel, //IsEnabled = false }; //widthSegment.SetBinding(Forms9Patch.Segment.IsEnabledProperty, "HasImposedSize"); fitSelector.Segments.Add(widthSegment); var linesSegment = new Forms9Patch.Segment { Text = "Lines", Command = new Command(x => { f9pLabel.Fit = Forms9Patch.LabelFit.Lines; }), //IsEnabled = f9pLabel.HasImposedSize, BindingContext = f9pLabel }; //linesSegment.SetBinding(Forms9Patch.Segment.IsEnabledProperty, "HasImposedSize"); fitSelector.Segments.Add(linesSegment); fitSelector.SelectIndex(0); #endregion #region Alignment Selection var hzAlignmentSelector = new Forms9Patch.MaterialSegmentedControl(); var vtAlignmentSelector = new Forms9Patch.MaterialSegmentedControl(); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Start", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.Start; xfLabel.HorizontalTextAlignment = TextAlignment.Start; }) } ); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Center", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.Center; xfLabel.HorizontalTextAlignment = TextAlignment.Center; }) } ); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "End", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.End; xfLabel.HorizontalTextAlignment = TextAlignment.End; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Start", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.Start; xfLabel.VerticalTextAlignment = TextAlignment.Start; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Center", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.Center; xfLabel.VerticalTextAlignment = TextAlignment.Center; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "End", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.End; xfLabel.VerticalTextAlignment = TextAlignment.End; }) } ); hzAlignmentSelector.SelectIndex(0); vtAlignmentSelector.SelectIndex(0); #endregion #region BreakMode selection var breakModeSelector = new Forms9Patch.MaterialSegmentedControl(); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "NoWrap", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.NoWrap; xfLabel.LineBreakMode = LineBreakMode.NoWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Char", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.CharacterWrap; xfLabel.LineBreakMode = LineBreakMode.CharacterWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Word", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.WordWrap; xfLabel.LineBreakMode = LineBreakMode.WordWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Head", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.HeadTruncation; xfLabel.LineBreakMode = LineBreakMode.HeadTruncation; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Mid", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.MiddleTruncation; xfLabel.LineBreakMode = LineBreakMode.MiddleTruncation; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Tail", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.TailTruncation; xfLabel.LineBreakMode = LineBreakMode.TailTruncation ; }) } ); breakModeSelector.SelectIndex(2); #endregion #region FontSelection Picker fontPicker = new Picker { Title = "Default", //HeightRequest = 300, //VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.EndAndExpand, }; var fontFamilies = Forms9Patch.FontExtensions.LoadedFontFamilies(); foreach (var fontFamily in fontFamilies) { fontPicker.Items.Add(fontFamily); } fontPicker.SelectedIndexChanged += (sender, e) => { string family = null; if (fontPicker.SelectedIndex > -1 && fontPicker.SelectedIndex < fontFamilies.Count) { f9pLabel.FontFamily = fontFamilies[fontPicker.SelectedIndex]; xfLabel.FontFamily = fontFamilies[fontPicker.SelectedIndex]; editor.FontFamily = fontFamilies[fontPicker.SelectedIndex]; } }; #endregion Content = new ScrollView { Padding = 0, Content = new StackLayout { Padding = 20, Children = { new Label { Text = "Text:" }, editor, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "HTML Formatted:", HorizontalOptions = LayoutOptions.StartAndExpand, }, modeSwitch }, }, new Label { Text = "Forms9Patch.Label:" }, f9pLabel, new Label { Text = "Font Family:", HorizontalOptions = LayoutOptions.Start }, fontPicker, fontSizeLabel, fontSizeSlider, actualFontSizeLabel, new Label { Text = "Fit:" }, fitSelector, linesLabel, linesSlider, new Label { Text = "Horizontal Alignment:" }, hzAlignmentSelector, new Label { Text = "Vertical Alignment:" }, vtAlignmentSelector, new Label { Text = "Truncation Mode:" }, breakModeSelector, } } }; }
public ModalPopupTestPage() { BackgroundColor = Color.White; Padding = new Thickness(20, Device.OnPlatform(20, 0, 0), 20, 20); var shadowToggle = new Switch(); shadowToggle.SetBinding(Switch.IsToggledProperty, "HasShadow"); shadowToggle.BindingContext = this; var shadowInvertedToggle = new Switch(); shadowInvertedToggle.SetBinding(Switch.IsToggledProperty, "ShadowInverted"); shadowInvertedToggle.BindingContext = this; var cornerRadiusSlider = new Slider { Maximum = 40, Minimum = 0, HeightRequest = 20, }; cornerRadiusSlider.SetBinding(Slider.ValueProperty, "CornerRadius"); cornerRadiusSlider.BindingContext = this; var paddingSlider = new Slider { Maximum = 100, Minimum = 0, HeightRequest = 20, }; paddingSlider.SetBinding(Slider.ValueProperty, "PUDPadding"); paddingSlider.BindingContext = this; //var listener = new FormsOrientation.Listener (); var hidePopupButton = new Forms9Patch.MaterialButton { Text = "DONE", BackgroundColor = Color.Blue, DarkTheme = true, }; var showPopupButton = new Forms9Patch.MaterialButton { Text = "Show Modal popup", BackgroundColor = Color.Blue, DarkTheme = true, WidthRequest = 150, HorizontalOptions = LayoutOptions.Center, }; var cancelOnBackgroundTouchButton = new Forms9Patch.MaterialButton { Text = "Cancel on Background touch", ToggleBehavior = true, IsSelected = true }; cancelOnBackgroundTouchButton.SetBinding(Forms9Patch.MaterialButton.IsSelectedProperty, "CancelOnBackgroundTouch"); cancelOnBackgroundTouchButton.BindingContext = this; var blackSegment = new Forms9Patch.Segment { HtmlText = "<font color=\"#000000\">Black</font>" }; var redSegment = new Forms9Patch.Segment { HtmlText = "<font color=\"#FF0000\">Red</font>" }; var greenSegment = new Forms9Patch.Segment { HtmlText = "<font color=\"#00FF00\">Green</font>" }; var blueSegment = new Forms9Patch.Segment { HtmlText = "<font color=\"#0000FF\">Blue</font>" }; var overlayColorSelector = new Forms9Patch.MaterialSegmentedControl { Segments = { blackSegment, redSegment, greenSegment, blueSegment, }, BackgroundColor = Color.White }; var modal = new Forms9Patch.ModalPopup { Content = new StackLayout { Children = { new Label { Text = "Hello Modal popup!", TextColor = Color.Black, }, new Label { Text = "Padding:", FontSize = 10, }, paddingSlider, new Label { Text = "Corner Radius:", FontSize = 10, }, cornerRadiusSlider, hidePopupButton, new Label { Text = "PageOverlayColor:", FontSize = 10, }, overlayColorSelector }, //BackgroundColor = Color.FromRgb(100,100,100), //Padding = 20, }, OutlineRadius = 4, OutlineWidth = 1, OutlineColor = Color.Black, BackgroundColor = Color.Aqua, HasShadow = true, HeightRequest = 200, WidthRequest = 200, }; modal.SetBinding(Forms9Patch.ModalPopup.OutlineRadiusProperty, "CornerRadius"); modal.SetBinding(Forms9Patch.ModalPopup.OutlineWidthProperty, "OutlineWidth"); modal.SetBinding(Forms9Patch.ModalPopup.PaddingProperty, "PUPadding"); modal.SetBinding(Forms9Patch.ModalPopup.HasShadowProperty, "HasShadow"); modal.SetBinding(Forms9Patch.ModalPopup.ShadowInvertedProperty, "ShadowInverted"); modal.SetBinding(Forms9Patch.ModalPopup.CancelOnPageOverlayTouchProperty, "CancelOnBackgroundTouch"); modal.BindingContext = this; showPopupButton.Tapped += (sender, e) => { modal.IsVisible = true; }; hidePopupButton.Tapped += (sender, e) => { modal.IsVisible = false; System.Diagnostics.Debug.WriteLine("button " + showPopupButton.Text); }; blackSegment.Selected += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(0, 0, 0, 128); }; redSegment.Selected += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(255, 0, 0, 128); }; greenSegment.Selected += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(0, 255, 0, 128); }; blueSegment.Selected += (sender, e) => { modal.PageOverlayColor = Color.FromRgba(0, 0, 255, 128); }; Detail = new ContentPage { BackgroundColor = Color.White, Title = "PopupTestPage - Detail", Content = new StackLayout { Children = { new Label { Text = "Hello ContentPage", TextColor = Color.Black, }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new StackLayout { Children = { new Label { Text = "Has Shadow", FontSize = 10, }, shadowToggle, }, HorizontalOptions = LayoutOptions.StartAndExpand, }, new StackLayout { Children = { new Label { Text = "Inset Shadow", FontSize = 10, }, shadowInvertedToggle, }, HorizontalOptions = LayoutOptions.EndAndExpand, } } }, cancelOnBackgroundTouchButton, showPopupButton, }, Padding = 20, }, }; Master = new ContentPage { Title = "PopupTestPage - Master", Content = new Label { Text = "Master Page", }, BackgroundColor = Color.Gray, }; }
public UnconstrainedLabelFitPage() { BackgroundColor = Color.Gray; Padding = 0; #region Editor var editor = new Editor { //Text = "Żorem ipsum dolor sit amet, consectetur adięiscing ełit", Text = text1, TextColor = Color.White, BackgroundColor = Color.Black, HeightRequest = 130, FontSize = 15, }; editor.Effects.Add(Effect.Resolve("Forms9Patch.CustomFontEffect")); #endregion #region Xamarin Forms label var xfLabel = new Label { FontSize = 15, TextColor = Color.White, BackgroundColor = Color.Black, Text = editor.Text }; #endregion #region Forms9Patch Label var f9pLabel = new Forms9Patch.Label { //HeightRequest = 50, Lines = 3, FontSize = 15, TextColor = Color.White, Fit = Forms9Patch.LabelFit.None, BackgroundColor = Color.Black, Text = editor.Text }; #endregion #region Mode var modeSwitch = new Switch { IsToggled = false, HorizontalOptions = LayoutOptions.End, }; modeSwitch.Toggled += (sender, e) => { if (modeSwitch.IsToggled) f9pLabel.HtmlText = editor.Text; else f9pLabel.Text = editor.Text; }; #endregion #region Sync text between Editor and Labels editor.TextChanged += (sender, e) => { xfLabel.Text = editor.Text; f9pLabel.HtmlText = editor.Text; }; #endregion #region Font Size selection var fontSizeSlider = new Slider { Maximum = 104, Minimum = 4, Value = 15 }; var fontSizeLabel = new Label { Text = "Font Size: 15" }; fontSizeSlider.ValueChanged += (sender, e) => { fontSizeLabel.Text = "Font Size: " + fontSizeSlider.Value; f9pLabel.FontSize = fontSizeSlider.Value; if (!rendering) { rendering = true; xfLabel.FontSize = fontSizeSlider.Value; Device.StartTimer(TimeSpan.FromMilliseconds(50), () => { if (Math.Abs(xfLabel.FontSize - lastFontSize) > double.Epsilon * 5) { xfLabel.FontSize = lastFontSize; return true; } rendering = false; return false; }); } lastFontSize = fontSizeSlider.Value; }; var actualFontSizeLabel = new Label { Text = "Actual Font Size: 15" }; f9pLabel.PropertyChanged += (sender, e) => { if (e.PropertyName == Forms9Patch.Label.ActualFontSizeProperty.PropertyName) actualFontSizeLabel.Text = "ActualFontSize: " + f9pLabel.ActualFontSize; }; #endregion #region Lines selection var linesLabel = new Label { Text = "Lines: 3" }; var linesSlider = new Slider { Minimum = 0, Maximum = 8, Value = 3 }; linesSlider.ValueChanged += (sender, e) => { linesLabel.Text = "Lines: " + ((int)Math.Round(linesSlider.Value)); f9pLabel.Lines = ((int)Math.Round(linesSlider.Value)); }; #endregion #region Fit Selection var fitSelector = new Forms9Patch.MaterialSegmentedControl(); fitSelector.Segments.Add(new Forms9Patch.Segment { Text = "None", Command = new Command(x => { f9pLabel.Fit = Forms9Patch.LabelFit.None; }) }); var widthSegment = new Forms9Patch.Segment { Text = "Width", Command = new Command(x => { f9pLabel.Fit = Forms9Patch.LabelFit.Width; }), //IsEnabled = f9pLabel.HasImposedSize, BindingContext = f9pLabel, //IsEnabled = false }; //widthSegment.SetBinding(Forms9Patch.Segment.IsEnabledProperty, "HasImposedSize"); fitSelector.Segments.Add(widthSegment); var linesSegment = new Forms9Patch.Segment { Text = "Lines", Command = new Command(x => { f9pLabel.Fit = Forms9Patch.LabelFit.Lines; }), //IsEnabled = f9pLabel.HasImposedSize, BindingContext = f9pLabel }; //linesSegment.SetBinding(Forms9Patch.Segment.IsEnabledProperty, "HasImposedSize"); fitSelector.Segments.Add(linesSegment); fitSelector.SelectIndex(0); #endregion #region Alignment Selection var hzAlignmentSelector = new Forms9Patch.MaterialSegmentedControl(); var vtAlignmentSelector = new Forms9Patch.MaterialSegmentedControl(); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Start", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.Start; xfLabel.HorizontalTextAlignment = TextAlignment.Start; }) } ); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Center", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.Center; xfLabel.HorizontalTextAlignment = TextAlignment.Center; }) } ); hzAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "End", Command = new Command(x => { f9pLabel.HorizontalTextAlignment = TextAlignment.End; xfLabel.HorizontalTextAlignment = TextAlignment.End; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Start", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.Start; xfLabel.VerticalTextAlignment = TextAlignment.Start; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "Center", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.Center; xfLabel.VerticalTextAlignment = TextAlignment.Center; }) } ); vtAlignmentSelector.Segments.Add( new Forms9Patch.Segment { Text = "End", Command = new Command(x => { f9pLabel.VerticalTextAlignment = TextAlignment.End; xfLabel.VerticalTextAlignment = TextAlignment.End; }) } ); hzAlignmentSelector.SelectIndex(0); vtAlignmentSelector.SelectIndex(0); #endregion #region BreakMode selection var breakModeSelector = new Forms9Patch.MaterialSegmentedControl(); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "NoWrap", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.NoWrap; xfLabel.LineBreakMode = LineBreakMode.NoWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Char", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.CharacterWrap; xfLabel.LineBreakMode = LineBreakMode.CharacterWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Word", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.WordWrap; xfLabel.LineBreakMode = LineBreakMode.WordWrap; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Head", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.HeadTruncation; xfLabel.LineBreakMode = LineBreakMode.HeadTruncation; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Mid", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.MiddleTruncation; xfLabel.LineBreakMode = LineBreakMode.MiddleTruncation; }) } ); breakModeSelector.Segments.Add( new Forms9Patch.Segment { Text = "Tail", Command = new Command(x => { f9pLabel.LineBreakMode = LineBreakMode.TailTruncation; xfLabel.LineBreakMode = LineBreakMode.TailTruncation ; }) } ); breakModeSelector.SelectIndex(2); #endregion #region FontSelection Picker fontPicker = new Picker { Title = "Default", //HeightRequest = 300, //VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.EndAndExpand, }; var fontFamilies = Forms9Patch.FontExtensions.LoadedFontFamilies(); foreach (var fontFamily in fontFamilies) fontPicker.Items.Add(fontFamily); fontPicker.SelectedIndexChanged += (sender, e) => { string family = null; if (fontPicker.SelectedIndex > -1 && fontPicker.SelectedIndex < fontFamilies.Count) { f9pLabel.FontFamily = fontFamilies[fontPicker.SelectedIndex]; xfLabel.FontFamily = fontFamilies[fontPicker.SelectedIndex]; editor.FontFamily = fontFamilies[fontPicker.SelectedIndex]; } }; #endregion Content = new ScrollView { Padding = 0, Content = new StackLayout { Padding = 20, Children = { new Label { Text = "Text:" }, editor, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "HTML Formatted:", HorizontalOptions = LayoutOptions.StartAndExpand, }, modeSwitch }, }, new Label { Text = "Forms9Patch.Label:" }, f9pLabel, new Label { Text = "Font Family:", HorizontalOptions = LayoutOptions.Start }, fontPicker, fontSizeLabel, fontSizeSlider, actualFontSizeLabel, new Label { Text = "Fit:" }, fitSelector, linesLabel, linesSlider, new Label { Text = "Horizontal Alignment:" }, hzAlignmentSelector, new Label { Text = "Vertical Alignment:" }, vtAlignmentSelector, new Label { Text = "Truncation Mode:" }, breakModeSelector, } } }; }
public HtmlButtonsPage() { Padding = 20; BackgroundColor = Color.White; #region Material Button var mb1 = new Forms9Patch.MaterialButton { HtmlText = "<i>Markup</i> button <font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>", //Text = "Pizza", BackgroundColor = Color.FromRgb(200, 200, 200), FontColor = Color.Blue, HasShadow = true, ToggleBehavior = true, }; mb1.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine("Tapped"); mb1.Selected += (sender, e) => System.Diagnostics.Debug.WriteLine("Selected"); mb1.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine("Long Pressing"); mb1.LongPressed += (sender, e) => System.Diagnostics.Debug.WriteLine("Long Pressed"); #endregion #region Segmented Button var sc1 = new Forms9Patch.MaterialSegmentedControl { HasShadow = true, BackgroundColor = Color.FromRgb(200, 200, 200), //FontColor = Color.Blue, Segments = { new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Cart", }, new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Pay", }, new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Ship", }, new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Email", }, }, }; sc1.SegmentSelected += OnSegmentSelected; sc1.SegmentTapped += OnSegmentTapped; sc1.SegmentLongPressing += OnSegmentLongPressing; sc1.SegmentLongPressed += OnSegmentLongPressed; #endregion #region Image Button var ib1 = new Forms9Patch.ImageButton { DefaultState = new Forms9Patch.ImageButtonState { BackgroundImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.button"), }, Image = new Image { Source = ImageSource.FromFile("five.png"), }, FontColor = Color.White, //Text = "Sticky w/ SelectedState", HtmlText = "<b>Sticky</b> with <i>SelectedState</i>", }, SelectedState = new Forms9Patch.ImageButtonState { BackgroundImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.image"), }, FontColor = Color.Red, //Text = "Selected", HtmlText = "<b><i>Selected</i></b>", }, ToggleBehavior = true, HeightRequest = 50, Alignment = TextAlignment.Start, }; ib1.Tapped += OnImageButtonTapped; ib1.Selected += OnImageButtonSelected; ib1.LongPressing += OnImageButtonLongPressing; ib1.LongPressed += OnImageButtonLongPressed; #endregion Content = new StackLayout { Children = { new Forms9Patch.Label { HtmlText = "<b>HTML Buttons</b>" }, mb1, sc1, ib1, } }; }
public NestedBubblePopupPage() { BackgroundColor = Color.White; switch (Device.RuntimePlatform) { case Device.iOS: Padding = new Thickness(20); break; default: Padding = new Thickness(20, 0, 20, 20); break; } var shadowToggle = new Switch(); shadowToggle.SetBinding(Switch.IsToggledProperty, "HasShadow"); shadowToggle.BindingContext = this; var shadowInvertedToggle = new Switch(); shadowInvertedToggle.SetBinding(Switch.IsToggledProperty, "ShadowInverted"); shadowInvertedToggle.BindingContext = this; var cornerRadiusSlider = new Slider { Maximum = 40, Minimum = 0, HeightRequest = 20, }; cornerRadiusSlider.SetBinding(Slider.ValueProperty, "CornerRadius"); cornerRadiusSlider.BindingContext = this; var pointerLengthSlider = new Slider { Maximum = 40, Minimum = 0, HeightRequest = 20, }; pointerLengthSlider.SetBinding(Slider.ValueProperty, "PointerLength"); pointerLengthSlider.BindingContext = this; var pointerTipRadiusSlider = new Slider { Maximum = 20, Minimum = 0, HeightRequest = 20, }; pointerTipRadiusSlider.SetBinding(Slider.ValueProperty, "PointerTipRadius"); pointerTipRadiusSlider.BindingContext = this; var paddingSlider = new Slider { Maximum = 100, Minimum = 0, HeightRequest = 20, }; paddingSlider.SetBinding(Slider.ValueProperty, "PUDPadding"); paddingSlider.BindingContext = this; var pointerCornerRadiusSlider = new Slider { Maximum = 20, Minimum = 0, HeightRequest = 20, }; pointerCornerRadiusSlider.SetBinding(Slider.ValueProperty, "PointerCornerRadius"); pointerCornerRadiusSlider.BindingContext = this; var leftSeg = new Forms9Patch.Segment { Text = "⬅︎", IsSelected = true, }; leftSeg.Tapped += (sender, e) => _lastChanged = leftSeg.VisualElement; var upSeg = new Forms9Patch.Segment { Text = "⬆︎", }; upSeg.Tapped += (sender, e) => _lastChanged = upSeg.VisualElement; var rightSeg = new Forms9Patch.Segment { Text = "➡︎", }; rightSeg.Tapped += (sender, e) => _lastChanged = rightSeg.VisualElement; var downSeg = new Forms9Patch.Segment { Text = "⬇︎", }; downSeg.Tapped += (sender, e) => _lastChanged = downSeg.VisualElement; PointerDirection = Forms9Patch.PointerDirection.Left; var directionSegmentControl = new Forms9Patch.MaterialSegmentedControl { Segments = { leftSeg, upSeg, rightSeg, downSeg, }, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, }; directionSegmentControl.SegmentTapped += (sender, e) => { var dir = Forms9Patch.PointerDirection.None; dir |= (leftSeg.IsSelected ? Forms9Patch.PointerDirection.Left : Forms9Patch.PointerDirection.None); dir |= (rightSeg.IsSelected ? Forms9Patch.PointerDirection.Right : Forms9Patch.PointerDirection.None); dir |= (upSeg.IsSelected ? Forms9Patch.PointerDirection.Up : Forms9Patch.PointerDirection.None); dir |= (downSeg.IsSelected ? Forms9Patch.PointerDirection.Down : Forms9Patch.PointerDirection.None); PointerDirection = dir; System.Diagnostics.Debug.WriteLine("Direction changed"); }; var bubbleLabel = new Label { Text = "Forms9Patch.BubblePopup", TextColor = Color.Black, //BackgroundColor = Color.Green, }; var bubbleButton = new Forms9Patch.MaterialButton { Text = "Close", //BackgroundColor = Color.Blue, OutlineColor = Color.Blue, FontColor = Color.Blue, }; //bubbleLabel.SetBinding (Label.TextProperty, "CornerRadius"); bubbleLabel.BindingContext = this; var bubble = new Forms9Patch.BubblePopup(this) { //BackgroundColor = Color.Green, //OutlineColor = Color.Black, //OutlineWidth = 1, PointerCornerRadius = 0, Content = new StackLayout { Children = { //bubbleLabel, new Label { Text = "Pointer Length:", FontSize = 10, }, pointerLengthSlider, new Label { Text = "Pointer Tip Radius:", FontSize = 10, }, pointerTipRadiusSlider, new Label { Text = "Corner Radius:", FontSize = 10, }, cornerRadiusSlider, new Label { Text = "Pointer Corner Radius:", FontSize = 10, }, pointerCornerRadiusSlider, bubbleButton, } }, }; bubble.SetBinding(Forms9Patch.BubblePopup.OutlineRadiusProperty, "CornerRadius"); bubble.SetBinding(Forms9Patch.BubblePopup.PointerLengthProperty, "PointerLength"); bubble.SetBinding(Forms9Patch.BubblePopup.PointerTipRadiusProperty, "PointerTipRadius"); bubble.SetBinding(Forms9Patch.BubblePopup.PaddingProperty, "Padding"); bubble.SetBinding(Forms9Patch.BubblePopup.HasShadowProperty, "HasShadow"); bubble.SetBinding(Forms9Patch.BubblePopup.ShadowInvertedProperty, "ShadowInverted"); bubble.SetBinding(Forms9Patch.BubblePopup.PointerDirectionProperty, "PointerDirection"); bubble.SetBinding(Forms9Patch.BubblePopup.PointerCornerRadiusProperty, "PointerCornerRadius"); bubble.BindingContext = this; bubbleButton.Tapped += (sender, e) => bubble.IsVisible = false; bubble.Cancelled += (sender, e) => { var newbubble = new Forms9Patch.BubblePopup(this) { //BackgroundColor = Color.Green, //OutlineColor = Color.Black, //OutlineWidth = 1, Target = bubbleButton, PointerCornerRadius = 0, Content = new StackLayout { Children = { //bubbleLabel, new Label { Text = "Pointer Length:", FontSize = 10, }, pointerLengthSlider, new Label { Text = "Pointer Tip Radius:", FontSize = 10, }, pointerTipRadiusSlider, new Label { Text = "Corner Radius:", FontSize = 10, }, cornerRadiusSlider, new Label { Text = "Pointer Corner Radius:", FontSize = 10, }, pointerCornerRadiusSlider, bubbleButton, } }, }; newbubble.IsVisible = true; }; var showButton = new Forms9Patch.MaterialButton { Text = "Show BubblePopup", OutlineColor = Color.Blue, FontColor = Color.Blue, }; showButton.Tapped += (object sender, EventArgs e) => { bubble.Target = _lastChanged; bubble.IsVisible = true; }; _lastChanged = leftSeg.VisualElement; Content = new StackLayout { Children = { new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new StackLayout { Children = { new Label { Text = "Has Shadow", FontSize = 10, }, shadowToggle, }, HorizontalOptions = LayoutOptions.StartAndExpand, }, new StackLayout { Children = { new Label { Text = "Inset Shadow", FontSize = 10, }, shadowInvertedToggle, }, HorizontalOptions = LayoutOptions.EndAndExpand, } } }, new Label { Text = "Padding:", FontSize = 10, }, paddingSlider, new Label { Text = "Pointer Direction", FontSize = 10, }, directionSegmentControl, showButton, new Label { Text = "Arrows choose the BubblePopup's allowed pointer direction. Bubble's pointer will point at the last selected arrow-segment-button." }, } }; }
public BubblePopupTestPage() { BackgroundColor = Color.White; Padding = new Thickness(20,Device.OnPlatform(20,0,0),20,20); var shadowToggle = new Switch (); shadowToggle.SetBinding (Switch.IsToggledProperty, "HasShadow"); shadowToggle.BindingContext = this; var shadowInvertedToggle = new Switch (); shadowInvertedToggle.SetBinding (Switch.IsToggledProperty, "ShadowInverted"); shadowInvertedToggle.BindingContext = this; var cornerRadiusSlider = new Slider { Maximum = 40, Minimum = 0, HeightRequest = 20, }; cornerRadiusSlider.SetBinding (Slider.ValueProperty, "CornerRadius"); cornerRadiusSlider.BindingContext = this; var pointerLengthSlider = new Slider { Maximum = 40, Minimum = 0, HeightRequest = 20, }; pointerLengthSlider.SetBinding (Slider.ValueProperty, "PointerLength"); pointerLengthSlider.BindingContext = this; var pointerTipRadiusSlider = new Slider { Maximum = 20, Minimum = 0, HeightRequest = 20, }; pointerTipRadiusSlider.SetBinding (Slider.ValueProperty, "PointerTipRadius"); pointerTipRadiusSlider.BindingContext = this; var paddingSlider = new Slider { Maximum = 100, Minimum = 0, HeightRequest = 20, }; paddingSlider.SetBinding (Slider.ValueProperty, "PUDPadding"); paddingSlider.BindingContext = this; var pointerCornerRadiusSlider = new Slider { Maximum = 20, Minimum = 0, HeightRequest = 20, }; pointerCornerRadiusSlider.SetBinding (Slider.ValueProperty, "PointerCornerRadius"); pointerCornerRadiusSlider.BindingContext = this; var leftSeg = new Forms9Patch.Segment { Text = "⬅︎", IsSelected = true, }; leftSeg.Tapped += (sender, e) => _lastChanged = leftSeg.VisualElement; var upSeg = new Forms9Patch.Segment { Text = "⬆︎", }; upSeg.Tapped += (sender, e) => _lastChanged = upSeg.VisualElement; var rightSeg = new Forms9Patch.Segment { Text = "➡︎", }; rightSeg.Tapped += (sender, e) => _lastChanged = rightSeg.VisualElement; var downSeg = new Forms9Patch.Segment { Text = "⬇︎", }; downSeg.Tapped += (sender, e) => _lastChanged = downSeg.VisualElement; PointerDirection = Forms9Patch.PointerDirection.Left; var directionSegmentControl = new Forms9Patch.MaterialSegmentedControl { Segments = { leftSeg, upSeg, rightSeg, downSeg, }, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, }; directionSegmentControl.SegmentTapped += (sender,e) => { var dir = Forms9Patch.PointerDirection.None; dir |= (leftSeg.IsSelected ? Forms9Patch.PointerDirection.Left : Forms9Patch.PointerDirection.None); dir |= (rightSeg.IsSelected ? Forms9Patch.PointerDirection.Right : Forms9Patch.PointerDirection.None); dir |= (upSeg.IsSelected ? Forms9Patch.PointerDirection.Up : Forms9Patch.PointerDirection.None); dir |= (downSeg.IsSelected ? Forms9Patch.PointerDirection.Down : Forms9Patch.PointerDirection.None); PointerDirection = dir; System.Diagnostics.Debug.WriteLine("Direction changed"); }; var bubbleLabel = new Label { Text = "Forms9Patch.BubblePopup", TextColor = Color.Black, //BackgroundColor = Color.Green, }; var bubbleButton = new Forms9Patch.MaterialButton { Text = "Close", //BackgroundColor = Color.Blue, OutlineColor = Color.Blue, FontColor = Color.Blue, }; //bubbleLabel.SetBinding (Label.TextProperty, "CornerRadius"); bubbleLabel.BindingContext = this; var bubble = new Forms9Patch.BubblePopup { //BackgroundColor = Color.Green, //OutlineColor = Color.Black, //OutlineWidth = 1, PointerCornerRadius = 0, Content = new StackLayout { Children = { //bubbleLabel, new Label { Text = "Pointer Length:", FontSize=10, }, pointerLengthSlider, new Label { Text = "Pointer Tip Radius:", FontSize=10, }, pointerTipRadiusSlider, new Label { Text = "Corner Radius:" , FontSize=10, }, cornerRadiusSlider, new Label { Text = "Pointer Corner Radius:" , FontSize=10, }, pointerCornerRadiusSlider, bubbleButton, } }, }; bubble.SetBinding (Forms9Patch.BubblePopup.OutlineRadiusProperty, "CornerRadius"); bubble.SetBinding (Forms9Patch.BubblePopup.PointerLengthProperty, "PointerLength"); bubble.SetBinding (Forms9Patch.BubblePopup.PointerTipRadiusProperty, "PointerTipRadius"); bubble.SetBinding (Forms9Patch.BubblePopup.PaddingProperty, "PUPadding"); bubble.SetBinding (Forms9Patch.BubblePopup.HasShadowProperty, "HasShadow"); bubble.SetBinding (Forms9Patch.BubblePopup.ShadowInvertedProperty, "ShadowInverted"); bubble.SetBinding (Forms9Patch.BubblePopup.PointerDirectionProperty, "PointerDirection"); bubble.SetBinding (Forms9Patch.BubblePopup.PointerCornerRadiusProperty, "PointerCornerRadius"); bubble.BindingContext = this; bubbleButton.Tapped += (sender, e) => bubble.IsVisible = false; var showButton = new Forms9Patch.MaterialButton { Text = "Show BubblePopup", OutlineColor = Color.Blue, FontColor = Color.Blue, }; showButton.Tapped += (object sender, EventArgs e) => { bubble.Target = _lastChanged; bubble.IsVisible = true; }; _lastChanged = leftSeg.VisualElement; Content = new StackLayout { Children = { new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new StackLayout { Children = { new Label { Text = "Has Shadow", FontSize=10, }, shadowToggle, }, HorizontalOptions = LayoutOptions.StartAndExpand, }, new StackLayout { Children = { new Label { Text = "Inset Shadow", FontSize=10, }, shadowInvertedToggle, }, HorizontalOptions = LayoutOptions.EndAndExpand, } } }, new Label { Text = "Padding:", FontSize=10, }, paddingSlider, new Label { Text = "Pointer Direction", FontSize=10, }, directionSegmentControl, showButton, new Label { Text = "Arrows choose the BubblePopup's allowed pointer direction. Bubble's pointer will point at the last selected arrow-segment-button." }, } }; }
public HtmlButtonsPage() { Padding = 20; BackgroundColor = Color.White; #region Material Button var mb1 = new Forms9Patch.MaterialButton { HtmlText = "<i>Markup</i> button <font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>", //Text = "Pizza", BackgroundColor = Color.FromRgb(200,200,200), FontColor = Color.Blue, HasShadow = true, ToggleBehavior = true, }; mb1.Tapped += (sender, e) => System.Diagnostics.Debug.WriteLine ("Tapped"); mb1.Selected += (sender, e) => System.Diagnostics.Debug.WriteLine ("Selected"); mb1.LongPressing += (sender, e) => System.Diagnostics.Debug.WriteLine ("Long Pressing"); mb1.LongPressed += (sender, e) => System.Diagnostics.Debug.WriteLine ("Long Pressed"); #endregion #region Segmented Button var sc1 = new Forms9Patch.MaterialSegmentedControl { HasShadow = true, BackgroundColor = Color.FromRgb(200,200,200), //FontColor = Color.Blue, Segments = { new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Cart", }, new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Pay", }, new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Ship", }, new Forms9Patch.Segment { HtmlText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font> Email", }, }, }; sc1.SegmentSelected += OnSegmentSelected; sc1.SegmentTapped += OnSegmentTapped; sc1.SegmentLongPressing += OnSegmentLongPressing; sc1.SegmentLongPressed += OnSegmentLongPressed; #endregion #region Image Button var ib1 = new Forms9Patch.ImageButton { DefaultState = new Forms9Patch.ImageButtonState { BackgroundImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource ("Forms9PatchDemo.Resources.button"), }, Image = new Image { Source = ImageSource.FromFile("five.png"), }, FontColor = Color.White, //Text = "Sticky w/ SelectedState", HtmlText = "<b>Sticky</b> with <i>SelectedState</i>", }, SelectedState = new Forms9Patch.ImageButtonState { BackgroundImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource ("Forms9PatchDemo.Resources.image"), }, FontColor = Color.Red, //Text = "Selected", HtmlText = "<b><i>Selected</i></b>", }, ToggleBehavior = true, HeightRequest = 50, Alignment = TextAlignment.Start, }; ib1.Tapped += OnImageButtonTapped; ib1.Selected += OnImageButtonSelected; ib1.LongPressing += OnImageButtonLongPressing; ib1.LongPressed += OnImageButtonLongPressed; #endregion Content = new StackLayout { Children = { new Forms9Patch.Label { HtmlText = "<b>HTML Buttons</b>" }, mb1, sc1, ib1, } }; }
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 = FormsGestures.Listener.For(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 }, }, }; }
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 }, }, }; }