public SVG_ButtonBackgroundImage() { Padding = 40; var stateButton = new Forms9Patch.StateButton { ToggleBehavior = true }; stateButton.DefaultState.BackgroundImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.redWhiteGradient.svg"); stateButton.DefaultState.Text = "Forms9Patch.StateButton.DefaultState"; // only the default state is created by default. So have to create a pressing state stateButton.SelectedState = new Forms9Patch.ButtonState { BackgroundImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.blueWhiteGradient.svg"), Text = "Forms9Patch.StateButton.SelectedState" }; var button = new Forms9Patch.Button { Text = "Forms9Patch.Button", BackgroundImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.greenWhiteGradient.svg") }; Content = new StackLayout { Children = { new Label { Text = "SVG Button.BackgroundImage demo" }, stateButton, button, } }; }
public SingleButton() { var button = new Forms9Patch.Button { Text = "Click me", ToggleBehavior = true, BackgroundColor = Color.NavajoWhite, OutlineRadius = 5 }; var hasShadowSwitch = new Switch(); hasShadowSwitch.Toggled += (sender, e) => button.HasShadow = e.Value; var hasOutlineSwitch = new Switch(); hasOutlineSwitch.Toggled += (sender, e) => button.OutlineWidth = e.Value ? 1 : 0; Padding = 20; Content = new StackLayout { Children = { new Label { Text = "HasShadow" }, hasShadowSwitch, new Label { Text = "HasOutline" }, hasOutlineSwitch, button, } }; }
private void OnSinglePickerButtonClicked(object sender, EventArgs e) { var doneButton = new Forms9Patch.Button { BackgroundColor = Color.Blue, TextColor = Color.White, OutlineColor = Color.White, OutlineRadius = 4, OutlineWidth = 1, Text = "Done", HorizontalOptions = LayoutOptions.End, }; var cancelButton = new Forms9Patch.Button { BackgroundColor = Color.Black, TextColor = Color.White, OutlineColor = Color.White, OutlineRadius = 4, OutlineWidth = 1, Text = "Cancel", HorizontalOptions = LayoutOptions.EndAndExpand, }; var buttonBar = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { cancelButton, doneButton } }; var bubbleContent = new StackLayout { WidthRequest = 300, HeightRequest = 300, Children = { buttonBar, _singlePicker } }; var bubblePopup = new Forms9Patch.BubblePopup(_singlePickerButton) { PointerDirection = Forms9Patch.PointerDirection.Vertical, Content = bubbleContent, BackgroundColor = Color.Black, }; var selectedItemAtStart = _singlePicker.SelectedItem; doneButton.Clicked += async(s, args) => await bubblePopup.CancelAsync(); cancelButton.Clicked += async(s, args) => { _singlePicker.SelectedItem = selectedItemAtStart; await bubblePopup.CancelAsync(); }; bubblePopup.IsVisible = true; }
public SVG_ButtonBackgroundImage() { Padding = 40; var stateButton = new Forms9Patch.StateButton { ToggleBehavior = true }; stateButton.DefaultState.BackgroundImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.redWhiteGradient.svg"); stateButton.DefaultState.Text = "Forms9Patch.StateButton.DefaultState"; // only the default state is created by default. So have to create a pressing state stateButton.SelectedState = new Forms9Patch.ButtonState { BackgroundImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.blueWhiteGradient.svg"), Text = "Forms9Patch.StateButton.SelectedState" }; var button = new Forms9Patch.Button { Text = "Forms9Patch.Button", BackgroundImage = new Forms9Patch.Image("Forms9PatchDemo.Resources.greenWhiteGradient.svg") }; var svgString = $@" <svg xmlns=""http://www.w3.org/2000/svg"" viewBox=""0 0 96 105""> <g fill=""#97C024"" stroke=""#97C024"" stroke-linejoin=""round"" stroke-linecap=""round""> <path d=""M14,40v24M81,40v24M38,68v24M57,68v24M28,42v31h39v-31z"" stroke-width=""12""/> <path d=""M32,5l5,10M64,5l-6,10"" stroke-width=""2""/> </g> <path d=""M22,35h51v10h-51zM22,33c0-31,51-31,51,0"" fill=""#97C024""/> <g fill=""#FFF""> <circle cx=""36"" cy=""22"" r=""2""/> <circle cx=""59"" cy=""22"" r=""2""/> </g> </svg> "; var image = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromSvgText(svgString), HeightRequest = 200, WidthRequest = 200, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; Content = new StackLayout { Children = { image, } }; }
public ModalPopupOnMasterDetailPage() { var masterButton = new Forms9Patch.Button { Text = "Show Popup", TextColor = Color.White, Padding = 5, BackgroundColor = Color.Blue, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, OutlineRadius = 4, HasShadow = true, }; masterButton.Clicked += (s, e) => { Forms9Patch.TargetedToast.Create(masterButton, "POP-UP", "From Master Page"); }; Master = new ContentPage { Content = masterButton, BackgroundColor = Color.DarkGray, Title = "Master Page", }; var detailButton = new Forms9Patch.Button { Text = "Return", TextColor = Color.White, Padding = 5, BackgroundColor = Color.Blue, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, OutlineRadius = 4, HasShadow = true, }; detailButton.Clicked += (s, e) => { if (Navigation.ModalStack.Contains(this) || Navigation.ModalStack.Contains(Parent)) { Navigation.PopModalAsync(); } else { Navigation.PopAsync(); } }; Detail = new ContentPage { Content = detailButton, BackgroundColor = Color.LightGray, Title = "Detail Page", }; }
public SingleButton() { var button = new Forms9Patch.Button { Text = "Click me", ToggleBehavior = true, BackgroundColor = Color.NavajoWhite, OutlineRadius = 5 }; var hasShadowSwitch = new Switch(); hasShadowSwitch.Toggled += (sender, e) => button.HasShadow = e.Value; var hasOutlineSwitch = new Switch(); hasOutlineSwitch.Toggled += (sender, e) => button.OutlineWidth = e.Value ? 1 : 0; //var longPressSwitch = new Switch(); //longPressSwitch.Toggled += (s, e) => button.IsLongPressEnabled = e.Value; Padding = 20; Content = new StackLayout { Children = { new Label { Text = "HasShadow" }, hasShadowSwitch, new Label { Text = "HasOutline" }, hasOutlineSwitch, //new Label { Text = "Long Press Enabled"}, //longPressSwitch, button, } }; //button.IsLongPressEnabled = longPressSwitch.IsToggled; button.HasShadow = hasShadowSwitch.IsToggled; button.OutlineWidth = hasOutlineSwitch.IsToggled ? 1 : 0; button.Tapped += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Tapped: "); button.Clicked += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Clicked"); button.Selected += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Selected"); button.LongPressed += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Long Pressed"); button.LongPressing += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Long Pressing"); }
public FlyoutGestureFail() { var button = new Forms9Patch.Button { Text = "Present Flyout", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.White, TextColor = Color.Black }; button.Clicked += Button_Clicked; BackgroundColor = Color.LightGray; Content = button; }
public BubblePopupTestPage() { BackgroundColor = Color.White; 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.SegmentedControl { 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.Button { Text = "Close", //BackgroundColor = Color.Blue, OutlineColor = Color.Blue, TextColor = Color.Blue, }; //bubbleLabel.SetBinding (Label.TextProperty, "CornerRadius"); bubbleLabel.BindingContext = this; var addItemButton = new Forms9Patch.Button { Text = "Add Item", OutlineColor = Color.Black, OutlineWidth = 1, TextColor = Color.Red }; var removeItemButton = new Forms9Patch.Button { Text = "Remove Item", OutlineColor = Color.Black, OutlineWidth = 1, TextColor = Color.Red }; var enlargeItemsButton = new Forms9Patch.Button { Text = "Englarge Items", OutlineColor = Color.Black, OutlineWidth = 1, TextColor = Color.Black }; var shrinkItems = new Forms9Patch.Button { Text = "Shrink Items", OutlineColor = Color.Black, OutlineWidth = 1, TextColor = Color.Black }; var stackLayout = new Forms9Patch.StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Start, }; //stackLayout.Children.Add(new Label { Text = "X,", TextColor = Color.Green }); var contentView = new Xamarin.Forms.ContentView { Content = stackLayout, HorizontalOptions = LayoutOptions.Start }; var bubble = new Forms9Patch.BubblePopup(this) { //BackgroundColor = Color.Green, //OutlineColor = Color.Black, //OutlineWidth = 1, PointerCornerRadius = 0, Content = new StackLayout { Children = { bubbleLabel, contentView, new Label { Text = "Padding:", FontSize = 10, TextColor = Color.Black }, paddingSlider, new Label { Text = "Pointer Length:",FontSize = 10, TextColor = Color.Black }, pointerLengthSlider, new Label { Text = "Pointer Tip Radius:",FontSize = 10, TextColor = Color.Black }, pointerTipRadiusSlider, new Label { Text = "Corner Radius:",FontSize = 10, TextColor = Color.Black }, cornerRadiusSlider, new Label { Text = "Pointer Corner Radius:",FontSize = 10, TextColor = Color.Black }, pointerCornerRadiusSlider, bubbleButton, addItemButton, removeItemButton, enlargeItemsButton, shrinkItems } }, }; 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; //const bool Relayout = false; bubbleButton.Tapped += (sender, e) => bubble.IsVisible = false; addItemButton.Tapped += (sender, e) => { //var count = stackLayout.Children.Count(); //stackLayout.Children.Clear(); //for (int i = 0; i <= count; i++) stackLayout.Children.Add(new Label { Text = "X,", TextColor = Color.Green }); //bubble.WidthRequest = 1; stackLayout.WidthRequest = -1; var size = stackLayout.Measure(double.MaxValue, double.MinValue); System.Diagnostics.Debug.WriteLine("WIDTH=[" + stackLayout.Width + "] size.Request.Width=[" + size.Request.Width + "]"); //stackLayout.WidthRequest = size.Request.Width + 1; //this.CallMethod("InvalidateMeasure", new object[] {}); //contentView.WidthRequest = size.Request.Width; stackLayout.Children.Last().IsVisible = true; }; enlargeItemsButton.Tapped += (sender, e) => { var count = stackLayout.Children.Count(); var width = 1; if (count > 0) { width = ((Label)stackLayout.Children[0]).Text.Length; } string text = ""; for (int i = 0; i < width; i++) { text += "X"; } text += ","; stackLayout.Children.Clear(); for (int i = 0; i < count; i++) { stackLayout.Children.Add(new Label { Text = text, TextColor = Color.Green }); } //bubble.WidthRequest = 1; stackLayout.WidthRequest = -1; var size = stackLayout.Measure(double.MaxValue, double.MinValue); System.Diagnostics.Debug.WriteLine("WIDTH=[" + stackLayout.Width + "] size.Request.Width=[" + size.Request.Width + "]"); //stackLayout.WidthRequest = size.Request.Width + 1; //this.CallMethod("InvalidateMeasure", new object[] {}); //contentView.WidthRequest = size.Request.Width; }; shrinkItems.Tapped += (sender, e) => { var count = stackLayout.Children.Count(); var width = 1; if (count > 0) { width = ((Label)stackLayout.Children[0]).Text.Length; } string text = ""; for (int i = 0; i < width - 2; i++) { text += "X"; } text += ","; System.Diagnostics.Debug.WriteLine("Text=[" + text + "]"); stackLayout.Children.Clear(); for (int i = 0; i < count; i++) { stackLayout.Children.Add(new Label { Text = text, TextColor = Color.Green }); } //bubble.WidthRequest = 1; stackLayout.WidthRequest = -1; var size = stackLayout.Measure(double.MaxValue, double.MinValue); System.Diagnostics.Debug.WriteLine("WIDTH=[" + stackLayout.Width + "] size.Request.Width=[" + size.Request.Width + "]"); }; removeItemButton.Tapped += (sender, e) => { if (stackLayout.Children.Count > 0) { stackLayout.Children.Remove(stackLayout.Children.Last()); } }; var showButton = new Forms9Patch.Button { Text = "Show BubblePopup", OutlineColor = Color.Blue, TextColor = Color.Blue, }; showButton.Tapped += (object sender, EventArgs e) => { bubble.Target = _lastChanged; bubble.IsVisible = true; }; _lastChanged = leftSeg.VisualElement; Content = new StackLayout { Padding = 20, Children = { new StackLayout { Orientation = StackOrientation.Horizontal, Children = { new StackLayout { Children = { new Label { Text = "Has Shadow", FontSize = 10, TextColor = Color.Black }, shadowToggle, }, HorizontalOptions = LayoutOptions.StartAndExpand, }, new StackLayout { Children = { new Label { Text = "Inset Shadow", FontSize = 10, TextColor = Color.Black }, shadowInvertedToggle, }, HorizontalOptions = LayoutOptions.EndAndExpand, } } }, //new Label { Text = "Padding:", FontSize=10, TextColor=Color.Black }, //paddingSlider, new Label { Text = "Pointer Direction", FontSize = 10, TextColor = Color.Black }, 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.", TextColor = Color.Black }, } }; }
public SingleButton() { var button = new Forms9Patch.Button { Text = "Click me", ToggleBehavior = true, BackgroundColor = Color.NavajoWhite, OutlineRadius = 5 }; var footerButtonA = new Forms9Patch.Button { FontFamily = "Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf", Text = "", Margin = 5, Padding = 0, BackgroundColor = Color.White, OutlineWidth = 0, }; var footerButtonB = new Forms9Patch.Button { IconFontFamily = "Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf", IconText = "", Margin = 5, Padding = 0, BackgroundColor = Color.White, OutlineWidth = 0, }; var hasShadowSwitch = new Switch(); hasShadowSwitch.Toggled += (sender, e) => { button.HasShadow = e.Value; footerButtonA.HasShadow = e.Value; footerButtonB.HasShadow = e.Value; }; var hasOutlineSwitch = new Switch(); hasOutlineSwitch.Toggled += (sender, e) => { button.OutlineWidth = e.Value ? 1 : 0; footerButtonA.OutlineWidth = e.Value ? 1 : 0; footerButtonB.OutlineWidth = e.Value ? 1 : 0; }; //var longPressSwitch = new Switch(); //longPressSwitch.Toggled += (s, e) => button.IsLongPressEnabled = e.Value; Padding = 0; var stack = new StackLayout { Padding = 20, Children = { new Label { Text = "HasShadow" }, hasShadowSwitch, new Label { Text = "HasOutline" }, hasOutlineSwitch, //new Label { Text = "Long Press Enabled"}, //longPressSwitch, button, } }; var footer = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = 50 }, new ColumnDefinition { Width = 50 }, new ColumnDefinition { Width = GridLength.Star }, new ColumnDefinition { Width = 50 }, new ColumnDefinition { Width = 50 }, } }; footer.Children.Add(footerButtonA, 3, 0); footer.Children.Add(footerButtonB, 4, 0); var grid = new Grid { RowSpacing = 0, RowDefinitions = { new RowDefinition { Height = GridLength.Star }, new RowDefinition { Height = 50 } } }; grid.Children.Add(stack); grid.Children.Add(new BoxView { Color = Color.DarkGray }, 0, 1); grid.Children.Add(footer, 0, 1); Content = grid; //button.IsLongPressEnabled = longPressSwitch.IsToggled; button.HasShadow = hasShadowSwitch.IsToggled; footerButtonA.HasShadow = hasShadowSwitch.IsToggled; footerButtonB.HasShadow = hasShadowSwitch.IsToggled; button.OutlineWidth = hasOutlineSwitch.IsToggled ? 1 : 0; footerButtonA.OutlineWidth = hasOutlineSwitch.IsToggled ? 1 : 0; footerButtonB.OutlineWidth = hasOutlineSwitch.IsToggled ? 1 : 0; button.Tapped += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Tapped: "); button.Clicked += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Clicked"); button.Selected += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Selected"); button.LongPressed += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Long Pressed"); button.LongPressing += (object sender, EventArgs e) => Forms9Patch.Toast.Create(null, "Long Pressing"); }
public MaterialButtonsPage() { #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.Button { Text = "TI", IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, TintIcon = false, }; mb1.Tapped += OnMaterialButtonTapped; mb1.Selected += OnMaterialButtonSelected; mb1.LongPressing += OnMaterialButtonLongPressing; mb1.LongPressed += OnMaterialButtonLongPressed; var mb2 = new Forms9Patch.Button { //Text = "toggle", ToggleBehavior = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, }; mb2.Tapped += OnMaterialButtonTapped; mb2.Selected += OnMaterialButtonSelected; mb2.LongPressing += OnMaterialButtonLongPressing; mb2.LongPressed += OnMaterialButtonLongPressed; var mb3 = new Forms9Patch.Button { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }; mb3.Tapped += OnMaterialButtonTapped; mb3.Selected += OnMaterialButtonSelected; mb3.LongPressing += OnMaterialButtonLongPressing; mb3.LongPressed += OnMaterialButtonLongPressed; var mb4 = new Forms9Patch.Button { //Text = "selected disabled", IsEnabled = false, IsSelected = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, }; 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.Button { Text = "", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, OutlineWidth = 0, }, new Forms9Patch.Button { //Text = "toggle", ToggleBehavior = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, OutlineWidth = 0, }, new Forms9Patch.Button { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, OutlineWidth = 0, }, new Forms9Patch.Button { //Text = "selected disabled", IsEnabled = false, IsSelected = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, OutlineWidth = 0, }, new Label { Text = "Background Color, Light Theme", TextColor = Color.Black, }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image { Source = _infoIconSource }, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image { Source = _infoIconSource }, }, new Label { Text = "Shadow, Light Theme", TextColor = Color.Black, }, new Forms9Patch.Button { Text = "default", HasShadow = true, IconImage = new Forms9Patch.Image{ Source = _infoIconSource }, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, HasShadow = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, HasShadow = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, HasShadow = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }, new Label { Text = "Shadow Background Color, Light Theme", TextColor = Color.Black, }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }, }, }, 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.Button { Text = "default", DarkTheme = true, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, DarkTheme = true, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, }, new Label { Text = "Outline, Dark Theme", TextColor = Color.White, }, new Forms9Patch.Button { Text = "default", DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, OutlineWidth = 0, }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, OutlineWidth = 0, }, new Label { Text = "Background Color, Dark Theme", TextColor = Color.White, }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, }, new Label { Text = "Shadow, Dark Theme", TextColor = Color.White, }, new Forms9Patch.Button { Text = "default", DarkTheme = true, HasShadow = true, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, DarkTheme = true, HasShadow = true, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, HasShadow = true, }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, HasShadow = true, }, new Label { Text = "Shadow Background Color, Dark Theme", TextColor = Color.White, }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, }, new Forms9Patch.Button { 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.SegmentedControl { Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, Command = _trueCommand, CommandParameter = "sc1 A", }, new Forms9Patch.Segment { //Text = "B", IsSelected = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, 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", IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }; 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.SegmentedControl { OutlineWidth = 0, Padding = 3, Segments = { seg1, seg2, seg3, seg4, }, }; sc2.SegmentSelected += OnSegmentSelected; sc2.SegmentTapped += OnSegmentTapped; sc2.SegmentLongPressing += OnSegmentLongPressing; sc2.SegmentLongPressed += OnSegmentLongPressed; var sc3 = new Forms9Patch.SegmentedControl { //OutlineColor = Color.Transparent, BackgroundColor = Color.FromHex("#E0E0E0"), Padding = 3, 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, IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, }, }, }; sc3.SegmentSelected += OnSegmentSelected; sc3.SegmentTapped += OnSegmentTapped; sc3.SegmentLongPressing += OnSegmentLongPressing; sc3.SegmentLongPressed += OnSegmentLongPressed; var sc4 = new Forms9Patch.SegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), OutlineWidth = 0, SeparatorWidth = 1, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.None, Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A none", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "B none", IsSelected = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C none", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, }, new Forms9Patch.Segment { Text = "D none", IsEnabled = false, IconImage = new Forms9Patch.Image{ Source = _infoIconSource }, Orientation = StackOrientation.Vertical, }, }, }; sc4.SegmentSelected += OnSegmentSelected; sc4.SegmentTapped += OnSegmentTapped; sc4.SegmentLongPressing += OnSegmentLongPressing; sc4.SegmentLongPressed += OnSegmentLongPressed; var sc5 = new Forms9Patch.SegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, //OutlineRadius = 0, //OutlineWidth = 0, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A multi", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, }, new Forms9Patch.Segment { Text = "B multi", IsSelected = true, }, new Forms9Patch.Segment { Text = "C multi", }, new Forms9Patch.Segment { Text = "D multi", IsEnabled = false, }, }, }; sc5.SegmentSelected += OnSegmentSelected; sc5.SegmentTapped += OnSegmentTapped; sc5.SegmentLongPressing += OnSegmentLongPressing; sc5.SegmentLongPressed += OnSegmentLongPressed; var sc6 = new Forms9Patch.SegmentedControl { BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, //OutlineRadius = 0, OutlineWidth = 0, SeparatorWidth = 1, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.None, Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A none", }, new Forms9Patch.Segment { Text = "B none", IsSelected = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, //Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C none", }, new Forms9Patch.Segment { Text = "D none", 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 #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.SegmentedControl { //OutlineColor = Color.Transparent, DarkTheme = true, Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { //Text = "B", IsSelected = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.SegmentedControl { DarkTheme = true, OutlineWidth = 0, Padding = 3, Segments = { new Forms9Patch.Segment { //Text = "A", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.SegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), Padding = 3, 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, IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, }, }, }, new Forms9Patch.SegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), OutlineWidth = 0, Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, IconImage = new Forms9Patch.Image { Source = _infoIconSource }, Orientation = StackOrientation.Vertical, }, new Forms9Patch.Segment { Text = "C", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, IconImage = new Forms9Patch.Image{ Source = _infoIconSource }, Orientation = StackOrientation.Vertical, }, }, }, new Forms9Patch.SegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), HasShadow = true, //OutlineRadius = 0, //OutlineWidth = 0, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A", IconImage = new Forms9Patch.Image{ Source = _arrowIconSource }, }, new Forms9Patch.Segment { Text = "B", IsSelected = true, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, new Forms9Patch.SegmentedControl { DarkTheme = true, BackgroundColor = Color.FromHex("#1194F6"), HasShadow = true, //OutlineRadius = 0, OutlineWidth = 0, SeparatorWidth = 1, Orientation = StackOrientation.Vertical, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, Padding = 3, Segments = { new Forms9Patch.Segment { Text = "A", }, new Forms9Patch.Segment { Text = "B", IsSelected = true, IconImage = new Forms9Patch.Image { Source = _arrowIconSource }, }, new Forms9Patch.Segment { Text = "C", }, new Forms9Patch.Segment { Text = "D", IsEnabled = false, }, }, }, }, }, #endregion #endregion }, }, }; }
public HtmlButtonsPage() { Padding = 20; BackgroundColor = Color.White; #region Material Button var mb1 = new Forms9Patch.Button { IconText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>", HtmlText = "<i>Markup</i> button", TrailingIcon = true, HasTightSpacing = true, Spacing = 10, //Text = "Pizza", BackgroundColor = Color.FromRgb(200, 200, 200), TextColor = 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.SegmentedControl { HasShadow = true, BackgroundColor = Color.FromRgb(200, 200, 200), FontSize = 15, Padding = 5, //TextColor = Color.Blue, Segments = { new Forms9Patch.Segment { Text = "Cart", IconText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>", }, new Forms9Patch.Segment { Text = "Pay", IconText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>", }, new Forms9Patch.Segment { Text = "Ship", IconText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>", }, new Forms9Patch.Segment { Text = "Email", IconText = "<font size=\"4\" face=\"Forms9PatchDemo.Resources.Fonts.MaterialIcons-Regular.ttf\"></font>", }, }, HasTightSpacing = true, IntraSegmentSpacing = 10 }; sc1.SegmentSelected += OnSegmentSelected; sc1.SegmentTapped += OnSegmentTapped; sc1.SegmentLongPressing += OnSegmentLongPressing; sc1.SegmentLongPressed += OnSegmentLongPressed; #endregion #region Image Button var ib1 = new Forms9Patch.StateButton { DefaultState = new Forms9Patch.ButtonState { BackgroundImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.button"), }, IconImage = new Forms9Patch.Image { Source = ImageSource.FromFile("five.png"), }, TextColor = Color.White, //Text = "Toggle w/ SelectedState", HtmlText = "<b>Toggle</b> with <i>SelectedState</i>", }, SelectedState = new Forms9Patch.ButtonState { BackgroundImage = new Forms9Patch.Image { Source = Forms9Patch.ImageSource.FromMultiResource("Forms9PatchDemo.Resources.image"), }, TextColor = Color.Red, //Text = "Selected", HtmlText = "<b><i>Selected</i></b>", }, ToggleBehavior = true, HeightRequest = 50, HorizontalTextAlignment = 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; //Padding = new Thickness(20, Device.RuntimePlatform == Device.iOS ? 20 : 0, 20, 20); var shadowToggle = new Switch(); var shadowInvertedToggle = new Switch(); var cornerRadiusSlider = new Slider { Maximum = 40, Minimum = 0, HeightRequest = 20, }; var pointerLengthSlider = new Slider { Maximum = 40, Minimum = 0, HeightRequest = 20, }; var pointerTipRadiusSlider = new Slider { Maximum = 20, Minimum = 0, HeightRequest = 20, }; var paddingSlider = new Slider { Maximum = 100, Minimum = 0, HeightRequest = 20, }; var pointerCornerRadiusSlider = new Slider { Maximum = 20, Minimum = 0, HeightRequest = 20, }; 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; var directionSegmentControl = new Forms9Patch.SegmentedControl { Segments = { leftSeg, upSeg, rightSeg, downSeg, }, GroupToggleBehavior = Forms9Patch.GroupToggleBehavior.Multiselect, }; var bubbleLabel = new Label { Text = "Forms9Patch.BubblePopup", TextColor = Color.Black, //BackgroundColor = Color.Green, }; var bubbleButton = new Forms9Patch.Button { Text = "Close", //BackgroundColor = Color.Blue, OutlineColor = Color.Blue, TextColor = Color.Blue, }; //bubbleLabel.SetBinding (Label.TextProperty, "CornerRadius"); bubbleLabel.BindingContext = this; var childBubbleButton = new Forms9Patch.Button("Show Child"); var bubble = new Forms9Patch.BubblePopup(this) { //BackgroundColor = Color.Green, //OutlineColor = Color.Black, //OutlineWidth = 1, Padding = 0, PointerCornerRadius = 0, Content = new StackLayout { Padding = 5, Children = { //bubbleLabel, childBubbleButton, bubbleButton, } }, }; cornerRadiusSlider.ValueChanged += (s, e) => bubble.OutlineRadius = (float)cornerRadiusSlider.Value; pointerLengthSlider.ValueChanged += (s, e) => bubble.PointerLength = (float)pointerLengthSlider.Value; pointerTipRadiusSlider.ValueChanged += (s, e) => bubble.PointerTipRadius = (float)pointerTipRadiusSlider.Value; shadowToggle.Toggled += (s, e) => bubble.HasShadow = shadowToggle.IsToggled; shadowInvertedToggle.Toggled += (s, e) => bubble.ShadowInverted = shadowInvertedToggle.IsToggled; pointerCornerRadiusSlider.ValueChanged += (s, e) => bubble.PointerCornerRadius = (float)pointerCornerRadiusSlider.Value; paddingSlider.ValueChanged += (s, e) => bubble.Padding = paddingSlider.Value; 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); bubble.PointerDirection = dir; System.Diagnostics.Debug.WriteLine("Direction changed"); }; bubbleButton.Tapped += (sender, e) => bubble.IsVisible = false; childBubbleButton.Clicked += (sender, e) => { var newBubbleCancelButton = new Forms9Patch.Button { Text = "Close", OutlineColor = Color.Blue, TextColor = Color.Blue, }; var newbubble = new Forms9Patch.BubblePopup(bubble) { //BackgroundColor = Color.Green, //OutlineColor = Color.Black, //OutlineWidth = 1, //Target = childBubbleButton, //PointerCornerRadius = 0, PointerDirection = Forms9Patch.PointerDirection.Any, 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, newBubbleCancelButton, } }, }; newbubble.IsVisible = true; newBubbleCancelButton.Clicked += async(s1, e1) => { await newbubble.CancelAsync(); }; }; var showButton = new Forms9Patch.Button { Text = "Show BubblePopup", OutlineColor = Color.Blue, TextColor = 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 ModalPopupTestPage() { 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 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.Button { Text = "DONE", BackgroundColor = Color.Blue, DarkTheme = true, }; var showPopupButton = new Forms9Patch.Button { Text = "Show Modal popup", BackgroundColor = Color.Blue, DarkTheme = true, WidthRequest = 150, HorizontalOptions = LayoutOptions.Center, }; var cancelOnBackgroundTouchButton = new Forms9Patch.Button { Text = "Cancel on Background touch", ToggleBehavior = true, IsSelected = true }; cancelOnBackgroundTouchButton.SetBinding(Forms9Patch.Button.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.SegmentedControl { 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 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.Button { Text = "", IconImage = new Forms9Patch.Image(arrowIcon), ElementShape = Forms9Patch.ElementShape.Obround }; mb1.Tapped += OnMaterialButtonTapped; mb1.Selected += OnMaterialButtonSelected; mb1.LongPressing += OnMaterialButtonLongPressing; mb1.LongPressed += OnMaterialButtonLongPressed; var mb2 = new Forms9Patch.Button { //Text = "toggle", ToggleBehavior = true, IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround, }; mb2.Tapped += OnMaterialButtonTapped; mb2.Selected += OnMaterialButtonSelected; mb2.LongPressing += OnMaterialButtonLongPressing; mb2.LongPressed += OnMaterialButtonLongPressed; var mb3 = new Forms9Patch.Button { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, IconImage = new Forms9Patch.Image(arrowIcon), ElementShape = Forms9Patch.ElementShape.Obround }; mb3.Tapped += OnMaterialButtonTapped; mb3.Selected += OnMaterialButtonSelected; mb3.LongPressing += OnMaterialButtonLongPressing; mb3.LongPressed += OnMaterialButtonLongPressed; var mb4 = new Forms9Patch.Button { //Text = "selected disabled", IsEnabled = false, IsSelected = true, IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround }; 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.Button { Text = "", IconImage = new Forms9Patch.Image(arrowIcon), OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { //Text = "toggle", ToggleBehavior = true, IconImage = new Forms9Patch.Image(infoIcon), OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { //Text = "disabled", ToggleBehavior = true, IsEnabled = false, IconImage = new Forms9Patch.Image(arrowIcon), OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { //Text = "selected disabled", IsEnabled = false, IsSelected = true, IconImage = new Forms9Patch.Image(infoIcon), OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Label { Text = "Background Color, Light Theme", TextColor = Color.Black }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image(arrowIcon), Orientation = StackOrientation.Vertical, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image(arrowIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Label { Text = "Shadow, Light Theme", TextColor = Color.Black }, new Forms9Patch.Button { Text = "default", HasShadow = true, IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, HasShadow = true, IconImage = new Forms9Patch.Image(arrowIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, HasShadow = true, IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, HasShadow = true, IconImage = new Forms9Patch.Image(arrowIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Label { Text = "Shadow Background Color, Light Theme", TextColor = Color.Black }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image(arrowIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image(infoIcon), ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#E0E0E0"), HasShadow = true, IconImage = new Forms9Patch.Image(arrowIcon), ElementShape = Forms9Patch.ElementShape.Obround }, }, }, 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.Button { Text = "default", DarkTheme = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, DarkTheme = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Label { Text = "Outline, Dark Theme", TextColor = Color.White }, new Forms9Patch.Button { Text = "default", DarkTheme = true, OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, DarkTheme = true, OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, OutlineWidth = 0, ElementShape = Forms9Patch.ElementShape.Obround }, new Label { Text = "Background Color, Dark Theme", TextColor = Color.White }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, IconImage = new Forms9Patch.Image(arrowIcon), Orientation = StackOrientation.Vertical, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Label { Text = "Shadow, Dark Theme", TextColor = Color.White }, new Forms9Patch.Button { Text = "default", DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Label { Text = "Shadow Background Color, Dark Theme", TextColor = Color.White }, new Forms9Patch.Button { Text = "default", BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "toggle", ToggleBehavior = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "disabled", ToggleBehavior = true, IsEnabled = false, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, new Forms9Patch.Button { Text = "selected disabled", IsEnabled = false, IsSelected = true, BackgroundColor = Color.FromHex("#1194F6"), DarkTheme = true, HasShadow = true, ElementShape = Forms9Patch.ElementShape.Obround }, }, }, 1, 0); #endregion Padding = 20; Content = new ScrollView { Content = new StackLayout { Children = { grid, }, }, }; }
public BubblePopupTestPage() { 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.SegmentedControl { 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.Button { Text = "Close", //BackgroundColor = Color.Blue, OutlineColor = Color.Blue, TextColor = Color.Blue, }; //bubbleLabel.SetBinding (Label.TextProperty, "CornerRadius"); bubbleLabel.BindingContext = this; var bubble = new Forms9Patch.BubblePopup(null) { //BackgroundColor = Color.Green, //OutlineColor = Color.Black, //OutlineWidth = 1, PointerCornerRadius = 0, Content = new StackLayout { Children = { //bubbleLabel, new Label { Text = "Pointer Length:", FontSize = 10, TextColor = Color.Black }, pointerLengthSlider, new Label { Text = "Pointer Tip Radius:", FontSize = 10, TextColor = Color.Black }, pointerTipRadiusSlider, new Label { Text = "Corner Radius:", FontSize = 10, TextColor = Color.Black }, cornerRadiusSlider, new Label { Text = "Pointer Corner Radius:", FontSize = 10, TextColor = Color.Black }, 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.Button { Text = "Show BubblePopup", OutlineColor = Color.Blue, TextColor = 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, TextColor = Color.Black }, shadowToggle, }, HorizontalOptions = LayoutOptions.StartAndExpand, }, new StackLayout { Children = { new Label { Text = "Inset Shadow", FontSize = 10, TextColor = Color.Black }, shadowInvertedToggle, }, HorizontalOptions = LayoutOptions.EndAndExpand, } } }, new Label { Text = "Padding:", FontSize = 10, TextColor = Color.Black }, paddingSlider, new Label { Text = "Pointer Direction", FontSize = 10, TextColor = Color.Black }, 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.", TextColor = Color.Black }, } }; }