Example #1
0
 private void DeleteOne_ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
     args.SwipeControl.Visibility = Visibility.Collapsed;
 }
Example #2
0
 private void SwipeItem_Invoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
     this.lv.Items.Remove(args.SwipeControl.DataContext);
 }
Example #3
0
        public void BtnAddItem_Click(object sender, RoutedEventArgs args)
        {
            SwipeItem swipeItem = new SwipeItem();

            swipeItem.Text = txtText.Text;
            switch (cmbIcon.SelectedIndex)
            {
            case (0):
                swipeItem.IconSource = Resources["SymbolIcon"] as IconSource;
                break;

            case (1):
                swipeItem.IconSource = Resources["FontIcon"] as IconSource;
                break;

            case (2):
                swipeItem.IconSource = Resources["BitmapIcon"] as IconSource;
                break;

            case (3):
                swipeItem.IconSource = Resources["PathIcon"] as IconSource;
                break;
            }
            swipeItem.Background = new SolidColorBrush(cpBackground.Color);
            switch (cmbBehaviorOnInvoked.SelectedIndex)
            {
            case (0):
                swipeItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.Auto;
                break;

            case (1):
                swipeItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.Close;
                break;

            case (2):
                swipeItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.RemainOpen;
                break;
            }
            SwipeItems swipeItems = null;

            switch (cmbCollection.SelectedIndex)
            {
            case (0):
                swipeItems = markupSwipeControl.LeftItems;
                if (swipeItems == null)
                {
                    swipeItems = new SwipeItems();
                    swipeItems.Add(swipeItem);
                    markupSwipeControl.LeftItems = swipeItems;
                }
                else
                {
                    swipeItems.Add(swipeItem);
                }
                break;

            case (1):
                swipeItems = markupSwipeControl.RightItems;
                if (swipeItems == null)
                {
                    swipeItems = new SwipeItems();
                    swipeItems.Add(swipeItem);
                    markupSwipeControl.RightItems = swipeItems;
                }
                else
                {
                    swipeItems.Add(swipeItem);
                }
                break;

            case (2):
                swipeItems = markupSwipeControl.TopItems;
                if (swipeItems == null)
                {
                    swipeItems = new SwipeItems();
                    swipeItems.Add(swipeItem);
                    markupSwipeControl.TopItems = swipeItems;
                }
                else
                {
                    swipeItems.Add(swipeItem);
                }
                break;

            case (3):
                swipeItems = markupSwipeControl.BottomItems;
                if (swipeItems == null)
                {
                    swipeItems = new SwipeItems();
                    swipeItems.Add(swipeItem);
                    markupSwipeControl.BottomItems = swipeItems;
                }
                else
                {
                    swipeItems.Add(swipeItem);
                }
                break;
            }
            switch (cmbMode.SelectedIndex)
            {
            case (0):
                swipeItems.Mode = SwipeMode.Reveal;
                break;

            case (1):
                swipeItems.Mode = SwipeMode.Execute;
                break;
            }
            resetSwipeItemChoices();
        }
        public SwipeBehaviorOnInvokedGallery()
        {
            Title = "SwipeBehaviorOnInvoked Gallery";

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var swipeBehaviorOnInvokedLabel = new Label
            {
                FontSize = 10,
                Text     = "SwipeBehaviorOnInvoked:"
            };

            swipeLayout.Children.Add(swipeBehaviorOnInvokedLabel);

            var swipeBehaviorOnInvokedItems = Enum.GetNames(typeof(SwipeBehaviorOnInvoked)).Select(s => s).ToList();

            var swipeBehaviorOnInvokedPicker = new Picker
            {
                ItemsSource   = swipeBehaviorOnInvokedItems,
                SelectedIndex = 0
            };

            swipeLayout.Children.Add(swipeBehaviorOnInvokedPicker);

            var deleteSwipeItem = new SwipeItem {
                BackgroundColor = Colors.Red, Text = "Delete", IconImageSource = "calculator.png"
            };

            deleteSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); };

            var leftSwipeItems = new SwipeItems
            {
                deleteSwipeItem
            };

            leftSwipeItems.Mode = SwipeMode.Reveal;
            leftSwipeItems.SwipeBehaviorOnInvoked = SwipeBehaviorOnInvoked.Auto;

            var swipeContent = new Grid
            {
                BackgroundColor = Colors.Gray
            };

            var swipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right (and tap the SwipeItem)"
            };

            swipeContent.Children.Add(swipeLabel);

            var swipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = leftSwipeItems,
                Content       = swipeContent
            };

            swipeLayout.Children.Add(swipeView);

            swipeBehaviorOnInvokedPicker.SelectedIndexChanged += (sender, e) =>
            {
                Enum.TryParse(swipeBehaviorOnInvokedPicker.SelectedItem.ToString(), out SwipeBehaviorOnInvoked swipeBehaviorOnInvoked);
                leftSwipeItems.SwipeBehaviorOnInvoked = swipeBehaviorOnInvoked;
            };

            Content = swipeLayout;
        }
Example #5
0
        void FillSwipeItemsCache(SwipeDirection swipeDirection, WSwipeItem windowsSwipeItem, SwipeItem formsSwipeItem)
        {
            switch (swipeDirection)
            {
            case SwipeDirection.Left:
                _leftItems.Add(windowsSwipeItem, formsSwipeItem);
                break;

            case SwipeDirection.Right:
                _rightItems.Add(windowsSwipeItem, formsSwipeItem);
                break;

            case SwipeDirection.Up:
                _topItems.Add(windowsSwipeItem, formsSwipeItem);
                break;

            case SwipeDirection.Down:
                _bottomItems.Add(windowsSwipeItem, formsSwipeItem);
                break;
            }
        }
Example #6
0
        protected override void Init()
        {
            Title = "Issue 8806";

            var layout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var instructions = new Label
            {
                BackgroundColor = Color.Black,
                TextColor       = Color.White,
                Text            = "Swipe left and right several times and verify that the layout is always correct."
            };

            var leftSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = "calculator.png",
                Text            = "Delete"
            };

            leftSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); };

            var rightSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.LightGoldenrodYellow,
                IconImageSource = "calculator.png",
                Text            = "Edit"
            };

            rightSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Edit Invoked", "Ok"); };

            var leftSwipeItems = new SwipeItems {
                leftSwipeItem
            };

            leftSwipeItems.Mode = SwipeMode.Reveal;

            var rightSwipeItems = new SwipeItems {
                leftSwipeItem, rightSwipeItem
            };

            rightSwipeItems.Mode = SwipeMode.Reveal;

            var swipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var swipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Left or Right"
            };

            swipeContent.Children.Add(swipeLabel);

            var swipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = leftSwipeItems,
                RightItems    = rightSwipeItems,
                Content       = swipeContent
            };

            layout.Children.Add(instructions);
            layout.Children.Add(swipeView);

            Content = layout;
        }
Example #7
0
        public SwipeViewEventsGallery()
        {
            Title = "SwipeView Events Gallery";

            var swipeLayout = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = GridLength.Auto
                    },
                    new RowDefinition {
                        Height = GridLength.Star
                    }
                },
                Margin = new Thickness(12)
            };

            var deleteSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.Orange,
                IconImageSource = "calculator.png",
                Text            = "SwipeItem1"
            };

            deleteSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); };

            var leftSwipeItems = new SwipeItems
            {
                deleteSwipeItem
            };

            leftSwipeItems.Mode = SwipeMode.Reveal;

            var swipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var swipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right"
            };

            swipeContent.Children.Add(swipeLabel);

            var scroll     = new ScrollView();
            var eventsInfo = new Label();

            scroll.Content = eventsInfo;

            var swipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = leftSwipeItems,
                Content       = swipeContent
            };

            swipeLayout.Children.Add(swipeView, 0, 0);
            swipeLayout.Children.Add(scroll, 0, 1);

            Content = swipeLayout;

            swipeView.SwipeStarted += (sender, e) =>
            {
                eventsInfo.Text += $"SwipeStarted - Direction:{e.SwipeDirection}" + Environment.NewLine;
            };

            swipeView.SwipeChanging += (sender, e) =>
            {
                eventsInfo.Text += $"SwipeChanging - Direction:{e.SwipeDirection}, Offset:{e.Offset}" + Environment.NewLine;
            };

            swipeView.SwipeEnded += (sender, e) =>
            {
                eventsInfo.Text += $"SwipeEnded - Direction:{e.SwipeDirection}, IsOpen: {e.IsOpen}" + Environment.NewLine;
            };
        }
Example #8
0
 private void DeleteItem_ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
 }
Example #9
0
 private void Flag_ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
 }
Example #10
0
 private async void SwipeItem_Invoked(SwipeItem sender, SwipeItemInvokedEventArgs args) => await _vm.SwipeItem_Invoked(sender, args);
Example #11
0
        protected override void Init()
        {
            Title = "Issue 9329";

            var layout = new StackLayout();

            var instructions = new Label
            {
                BackgroundColor = Colors.Black,
                TextColor       = Colors.White,
                Text            = "Check/uncheck the CheckBox to enable or disable the SwipeView."
            };

            var swipeItem = new SwipeItem {
                BackgroundColor = Colors.Red, Text = "Test", IconImageSource = "coffee.png"
            };

            var swipeView = new SwipeView
            {
                HeightRequest   = 60,
                BackgroundColor = Colors.LightGray,
                LeftItems       = new SwipeItems(new List <SwipeItem> {
                    swipeItem
                })
                {
                    Mode = SwipeMode.Execute
                },
                RightItems = new SwipeItems(new List <SwipeItem> {
                    swipeItem
                })
            };

            var content = new Grid
            {
                BackgroundColor = Colors.LightGoldenrodYellow
            };

            var info = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe"
            };

            content.Children.Add(info);

            swipeView.Content = content;

            var checkLayout = new StackLayout();

            checkLayout.Orientation = StackOrientation.Horizontal;

            var checkBox = new CheckBox
            {
                VerticalOptions = LayoutOptions.Center
            };

            var checkInfoLabel = new Label
            {
                Text            = "SwipeView Enabled",
                VerticalOptions = LayoutOptions.Center
            };

            checkBox.CheckedChanged += (sender, args) =>
            {
                swipeView.IsEnabled = !swipeView.IsEnabled;
                checkInfoLabel.Text = swipeView.IsEnabled ? "SwipeView Enabled" : "SwipeView Disabled";
            };

            checkLayout.Children.Add(checkBox);
            checkLayout.Children.Add(checkInfoLabel);

            layout.Children.Add(instructions);
            layout.Children.Add(swipeView);
            layout.Children.Add(checkLayout);

            Content = layout;
        }
Example #12
0
 private void Flag_ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
     args.SwipeControl.Background = new SolidColorBrush(Colors.Green);
 }
Example #13
0
 private void Accept_ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
     args.SwipeControl.Background = new SolidColorBrush(Colors.Cyan);
 }
Example #14
0
        private void DeleteItem_ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
        {
            int i = lv.Items.IndexOf(args.SwipeControl.DataContext);

            items.RemoveAt(1);
        }
Example #15
0
        public SwipeItemIsEnabledGallery()
        {
            Title = "SwipeItem IsEnabled Gallery";

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var instructions = new Label
            {
                BackgroundColor = Colors.Black,
                TextColor       = Colors.White,
                Text            = "RemainOpen is used as SwipeBehaviorOnInvoked, tapping on a SwipeItem will not close it."
            };

            swipeLayout.Children.Add(instructions);

            var closeButton = new Button
            {
                Text = "Close SwipeView"
            };

            swipeLayout.Children.Add(closeButton);

            var swipeItem1 = new SwipeItem
            {
                BackgroundColor = Colors.Red,
                IconImageSource = "calculator.png",
                Text            = "Test 1"
            };

            swipeItem1.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Test 1 Invoked", "Ok"); };

            var swipeItem2 = new SwipeItem
            {
                BackgroundColor = Colors.Orange,
                IconImageSource = "coffee.png",
                Text            = "Test 2"
            };

            swipeItem2.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Test 2 Invoked", "Ok"); };

            var swipeItems = new SwipeItems {
                swipeItem1, swipeItem2
            };

            swipeItems.SwipeBehaviorOnInvoked = SwipeBehaviorOnInvoked.RemainOpen;
            swipeItems.Mode = SwipeMode.Reveal;

            var swipeContent = new Grid
            {
                BackgroundColor = Colors.Gray
            };

            var fileSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right"
            };

            swipeContent.Children.Add(fileSwipeLabel);

            var swipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = swipeItems,
                Content       = swipeContent
            };

            swipeLayout.Children.Add(swipeView);


            var swipeItem1Layout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            var swipeItem1Button = new Button
            {
                Text            = "Disable SwipeItem 1",
                WidthRequest    = 250,
                VerticalOptions = LayoutOptions.Center
            };

            var swipeItem1Label = new Label
            {
                Text            = "SwipeItem 1 is enabled",
                VerticalOptions = LayoutOptions.Center
            };

            swipeItem1Layout.Children.Add(swipeItem1Button);
            swipeItem1Layout.Children.Add(swipeItem1Label);

            swipeLayout.Children.Add(swipeItem1Layout);

            var swipeItem2Layout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            var swipeItem2Button = new Button
            {
                Text            = "Disable SwipeItem 2",
                WidthRequest    = 250,
                VerticalOptions = LayoutOptions.Center
            };

            var swipeItem2Label = new Label
            {
                Text            = "SwipeItem 2 is enabled",
                VerticalOptions = LayoutOptions.Center
            };

            swipeItem2Layout.Children.Add(swipeItem2Button);
            swipeItem2Layout.Children.Add(swipeItem2Label);

            swipeLayout.Children.Add(swipeItem2Layout);

            Content = swipeLayout;

            closeButton.Clicked += (sender, e) =>
            {
                swipeView.Close();
            };

            swipeItem1Button.Clicked += (sender, args) =>
            {
                swipeItem1.IsEnabled = !swipeItem1.IsEnabled;

                if (swipeItem1.IsEnabled)
                {
                    swipeItem1Button.Text = "Disable SwipeItem 1";
                    swipeItem1Label.Text  = "SwipeItem 1 is enabled";
                }
                else
                {
                    swipeItem1Button.Text = "Enable SwipeItem 1";
                    swipeItem1Label.Text  = "SwipeItem 1 is disabled";
                }
            };

            swipeItem2Button.Clicked += (sender, args) =>
            {
                swipeItem2.IsEnabled = !swipeItem2.IsEnabled;

                if (swipeItem2.IsEnabled)
                {
                    swipeItem2Button.Text = "Disable SwipeItem 2";
                    swipeItem2Label.Text  = "SwipeItem 2 is enabled";
                }
                else
                {
                    swipeItem2Button.Text = "Enable SwipeItem 2";
                    swipeItem2Label.Text  = "SwipeItem 2 is disabled";
                }
            };
        }
Example #16
0
 private void Accept_ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
 }
Example #17
0
        public SwipeItemIconGallery()
        {
            Title = "SwipeItem Icon Gallery";

            var scroll = new ScrollView();

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var fileSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = "calculator.png",
                Text            = "File"
            };

            fileSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "File Invoked", "Ok"); };

            var fileSwipeItems = new SwipeItems {
                fileSwipeItem
            };

            fileSwipeItems.Mode = SwipeMode.Reveal;

            var fileSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var fileSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right (File)"
            };

            fileSwipeContent.Children.Add(fileSwipeLabel);

            var fileSwipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = fileSwipeItems,
                Content       = fileSwipeContent
            };

            swipeLayout.Children.Add(fileSwipeView);

            var urlSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = "https://image.flaticon.com/icons/png/512/61/61848.png",
                Text            = "Url"
            };

            urlSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Url Invoked", "Ok"); };

            var urlSwipeItems = new SwipeItems {
                urlSwipeItem
            };

            urlSwipeItems.Mode = SwipeMode.Reveal;

            var urlSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var urlSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right (Url)"
            };

            urlSwipeContent.Children.Add(urlSwipeLabel);

            var urlSwipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = urlSwipeItems,
                Content       = urlSwipeContent
            };

            swipeLayout.Children.Add(urlSwipeView);

            var fontFamily = string.Empty;

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                fontFamily = "Ionicons";
                break;

            case Device.UWP:
                fontFamily = "Assets/Fonts/ionicons.ttf#ionicons";
                break;

            case Device.Android:
            default:
                fontFamily = "fonts/ionicons.ttf#";
                break;
            }

            var fontSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = new FontImageSource
                {
                    Glyph      = "\uf101",
                    FontFamily = fontFamily,
                    Size       = 16
                },
                Text = "Url"
            };

            fontSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Font Invoked", "Ok"); };

            var fontSwipeItems = new SwipeItems {
                fontSwipeItem
            };

            fontSwipeItems.Mode = SwipeMode.Reveal;

            var fontSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var fontSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right (Font)"
            };

            fontSwipeContent.Children.Add(fontSwipeLabel);

            var fontSwipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = fontSwipeItems,
                Content       = fontSwipeContent
            };

            swipeLayout.Children.Add(fontSwipeView);

            scroll.Content = swipeLayout;

            Content = scroll;
        }
Example #18
0
 private void swipe_Invoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
 }
        public SwipeTransitionModeGallery()
        {
            Title = "SwipeTransitionMode Gallery";

            var scroll = new Xamarin.Forms.ScrollView();

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var instructions = new Label
            {
                BackgroundColor = Color.Black,
                TextColor       = Color.White,
                Text            = "This Gallery use a Platform Specific only available for Android and iOS."
            };

            swipeLayout.Children.Add(instructions);

            var swipeItemSwipeTransitionModeLabel = new Label
            {
                FontSize = 10,
                Text     = "SwipeTransitionMode:"
            };

            swipeLayout.Children.Add(swipeItemSwipeTransitionModeLabel);

            var swipeItemSwipeTransitionModePicker = new Xamarin.Forms.Picker();

            var swipeTransitionModes = Enum.GetNames(typeof(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode)).Select(t => t).ToList();

            swipeItemSwipeTransitionModePicker.ItemsSource   = swipeTransitionModes;
            swipeItemSwipeTransitionModePicker.SelectedIndex = 0;               // Reveal

            swipeLayout.Children.Add(swipeItemSwipeTransitionModePicker);

            var deleteSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = "delete.png",
                Text            = "Delete"
            };

            deleteSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); };

            var swipeItems = new SwipeItems {
                deleteSwipeItem
            };

            swipeItems.Mode = SwipeMode.Reveal;

            var leftSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var leftSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right"
            };

            leftSwipeContent.Children.Add(leftSwipeLabel);

            var leftSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = swipeItems,
                Content       = leftSwipeContent
            };

            swipeLayout.Children.Add(leftSwipeView);

            var rightSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var rightSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Left"
            };

            rightSwipeContent.Children.Add(rightSwipeLabel);

            var rightSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                RightItems    = swipeItems,
                Content       = rightSwipeContent
            };

            swipeLayout.Children.Add(rightSwipeView);

            var topSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var topSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Top"
            };

            topSwipeContent.Children.Add(topSwipeLabel);

            var topSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                BottomItems   = swipeItems,
                Content       = topSwipeContent
            };

            swipeLayout.Children.Add(topSwipeView);

            var bottomSwipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var bottomSwipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Bottom"
            };

            bottomSwipeContent.Children.Add(bottomSwipeLabel);

            var bottomSwipeView = new Xamarin.Forms.SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                TopItems      = swipeItems,
                Content       = bottomSwipeContent
            };

            swipeLayout.Children.Add(bottomSwipeView);

            swipeItemSwipeTransitionModePicker.SelectedIndexChanged += (sender, e) =>
            {
                var swipeTransitionMode = swipeItemSwipeTransitionModePicker.SelectedItem;

                switch (swipeTransitionMode)
                {
                case "Drag":
                    leftSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    leftSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    rightSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    rightSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    topSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    topSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    bottomSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    bottomSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);
                    break;

                case "Reveal":
                    leftSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Reveal);
                    leftSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Reveal);

                    rightSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    rightSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    topSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    topSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);

                    bottomSwipeView.On <Android>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.AndroidSpecific.SwipeTransitionMode.Drag);
                    bottomSwipeView.On <iOS>().SetSwipeTransitionMode(Xamarin.Forms.PlatformConfiguration.iOSSpecific.SwipeTransitionMode.Drag);
                    break;
                }
            };

            scroll.Content = swipeLayout;

            Content = scroll;
        }
Example #20
0
        public SecondIssue10679Page()
        {
            var layout = new Grid();

            var swipeView = new SwipeView();

            var leftItem = new SwipeItem
            {
                BackgroundColor = Color.Red
            };

            var leftItems = new SwipeItems
            {
                Mode = SwipeMode.Execute,
                SwipeBehaviorOnInvoked = SwipeBehaviorOnInvoked.Close
            };

            leftItems.Add(leftItem);

            var rightItem = new SwipeItem
            {
                BackgroundColor = Color.Green
            };

            var rightItems = new SwipeItems
            {
                Mode = SwipeMode.Execute,
                SwipeBehaviorOnInvoked = SwipeBehaviorOnInvoked.Close
            };

            rightItems.Add(rightItem);

            var content = new Grid
            {
                BackgroundColor = Color.White
            };

            var contentLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe Left or Right"
            };

            content.Children.Add(contentLabel);

            swipeView.Content    = content;
            swipeView.LeftItems  = leftItems;
            swipeView.RightItems = rightItems;

            layout.Children.Add(swipeView);

            Content = layout;

            leftItem.Invoked += async(sender, args) =>
            {
                Shell.Current.Navigation.InsertPageBefore(new ThirdIssue10679Page(), this);
                _ = await Shell.Current.Navigation.PopAsync(false);
            };

            rightItem.Invoked += async(sender, args) =>
            {
                Shell.Current.Navigation.InsertPageBefore(new ThirdIssue10679Page(), this);
                _ = await Shell.Current.Navigation.PopAsync(false);
            };
        }
 private void FavoriteSwipeItem_Invoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
 }
Example #22
0
        public SwipeView CreateMySwipeView()
        {
            // Define Right Swipe
            var rightSwipeItem = new SwipeItem
            {
                Text            = "Right",
                BackgroundColor = Color.Green,
                Command         = new Command(() =>
                {
                    _leftCount++;
                    _leftSwipeCountLabel.Text = _leftCount.ToString();
                })
            };

            var rightSwipeItems = new SwipeItems {
                rightSwipeItem
            };

            rightSwipeItems.SwipeBehaviorOnInvoked = SwipeBehaviorOnInvoked.Close;
            rightSwipeItems.Mode = SwipeMode.Execute;

            // Define Left Swipe
            var leftSwipeItem = new SwipeItem
            {
                Text            = "Left",
                BackgroundColor = Color.Red,
                Command         = new Command(() =>
                {
                    _rightCount++;
                    _rightSwipeCountLabel.Text = _rightCount.ToString();
                })
            };

            var leftSwipeItems = new SwipeItems {
                leftSwipeItem
            };

            leftSwipeItems.SwipeBehaviorOnInvoked = SwipeBehaviorOnInvoked.Close;
            leftSwipeItems.Mode = SwipeMode.Execute;


            // Define Swipe Content
            var swipeContent = new ContentView
            {
                Content = new StackLayout
                {
                    AutomationId    = SwipeViewId,
                    BackgroundColor = Color.Coral,
                    Children        =
                    {
                        new Label
                        {
                            Text = "Standalone SwipeItem",
                            HorizontalOptions = LayoutOptions.Center,
                            VerticalOptions   = LayoutOptions.Center
                        }
                    }
                }
            };


            // Create SwipeView
            var mySwipeView = new SwipeView
            {
                RightItems    = rightSwipeItems,
                LeftItems     = leftSwipeItems,
                Content       = swipeContent,
                HeightRequest = 80
            };

            return(mySwipeView);
        }
Example #23
0
        protected override void Init()
        {
            Title = "Issue 12079";

            var layout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var instructions = new Label
            {
                BackgroundColor = Color.Black,
                TextColor       = Color.White,
                Text            = "Swipe to the right, if can open the SwipeView the test has passed."
            };

            var swipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = "calculator.png"
            };

            swipeItem.Invoked += (sender, e) =>
            {
                DisplayAlert("Issue12079", "Invoked", "Ok");
            };

            var swipeItems = new SwipeItems {
                swipeItem
            };

            swipeItems.Mode = SwipeMode.Reveal;

            var swipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var swipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right (No Text)"
            };

            swipeContent.Children.Add(swipeLabel);

            var swipeView = new SwipeView
            {
                AutomationId  = SwipeViewId,
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = swipeItems,
                Content       = swipeContent
            };

            var result = new Label();

            swipeView.SwipeEnded += (sender, args) =>
            {
                result.Text = "Success";
            };

            layout.Children.Add(instructions);
            layout.Children.Add(swipeView);
            layout.Children.Add(result);

            Content = layout;
        }
Example #24
0
        private void UpdateSwipeControlItems()
        {
            var swipeControl = _swipeControl as SwipeControl;

            if (swipeControl == null)
            {
                return;
            }

            if (IsLeftCommandEnabled)
            {
                var leftItem  = _leftSwipeItem as SwipeItem;
                var leftItems = _leftSwipeItems as SwipeItems;

                if (leftItem == null)
                {
                    leftItem            = new SwipeItem();
                    leftItem.IconSource = new SymbolIconSource();
                    leftItem.Invoked   += LeftControl_Invoked;

                    leftItems = new SwipeItems()
                    {
                        leftItem
                    };
                    leftItems.Mode = SwipeMode.Execute;

                    _leftSwipeItems = leftItems;
                    _leftSwipeItem  = leftItem;
                }

                leftItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.Close;
                leftItem.Background        = LeftBackground;
                leftItem.Text                  = LeftLabel;
                leftItem.Foreground            = LeftForeground;
                leftItem.Command               = LeftCommand;
                leftItem.CommandParameter      = LeftCommandParameter;
                leftItem.IconSource.Foreground = LeftForeground;
                ((SymbolIconSource)leftItem.IconSource).Symbol = LeftIcon;

                swipeControl.LeftItems = leftItems;
            }
            else
            {
                swipeControl.LeftItems = null;
            }

            if (IsRightCommandEnabled)
            {
                var rightItem  = _rightSwipeItem as SwipeItem;
                var rightItems = _rightSwipeItems as SwipeItems;

                if (rightItem == null)
                {
                    rightItem            = new SwipeItem();
                    rightItem.IconSource = new SymbolIconSource();
                    rightItem.Invoked   += RightControl_Invoked;

                    rightItems = new SwipeItems()
                    {
                        rightItem
                    };
                    rightItems.Mode = SwipeMode.Execute;

                    _rightSwipeItems = rightItems;
                    _rightSwipeItem  = rightItem;
                }

                rightItem.BehaviorOnInvoked = SwipeBehaviorOnInvoked.Close;
                rightItem.Background        = RightBackground;
                rightItem.Text                  = RightLabel;
                rightItem.Foreground            = RightForeground;
                rightItem.Command               = RightCommand;
                rightItem.CommandParameter      = RightCommandParameter;
                rightItem.IconSource.Foreground = RightForeground;
                ((SymbolIconSource)rightItem.IconSource).Symbol = RightIcon;

                swipeControl.RightItems = rightItems;
            }
            else
            {
                swipeControl.RightItems = null;
            }
        }
Example #25
0
        public CustomizeSwipeItemGallery()
        {
            Title = "Customize SwipeItem Gallery";

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var swipeItemTextLabel = new Label
            {
                FontSize = 10,
                Text     = "SwipeItem Text:"
            };

            swipeLayout.Children.Add(swipeItemTextLabel);

            var swipeItemTextEntry = new Entry
            {
                Text        = "Delete",
                Placeholder = "SwipeItem Text"
            };

            swipeLayout.Children.Add(swipeItemTextEntry);

            var swipeItemBackgroundColorLabel = new Label
            {
                FontSize = 10,
                Text     = "Choose SwipeItem BackgroundColor:"
            };

            swipeLayout.Children.Add(swipeItemBackgroundColorLabel);

            var swipeItemBackgroundColorPicker = new Picker();
            var colors = new List <string> {
                "#FFFFFF", "#FF0000", "#00FF00", "#0000FF", "#000000"
            };

            swipeItemBackgroundColorPicker.ItemsSource  = colors;
            swipeItemBackgroundColorPicker.SelectedItem = colors[1];

            swipeLayout.Children.Add(swipeItemBackgroundColorPicker);


            var swipeItemIconLabel = new Label
            {
                FontSize = 10,
                Text     = "Choose SwipeItem Icon:"
            };

            swipeLayout.Children.Add(swipeItemIconLabel);

            var swipeItemIconPicker = new Picker();
            var icons = new List <string> {
                "bank.png", "calculator.png", "coffee.png"
            };

            swipeItemIconPicker.ItemsSource  = icons;
            swipeItemIconPicker.SelectedItem = icons[1];

            swipeLayout.Children.Add(swipeItemIconPicker);

            var deleteSwipeItem = new SwipeItem
            {
                BackgroundColor = Color.FromArgb(colors[swipeItemBackgroundColorPicker.SelectedIndex]),
                IconImageSource = swipeItemIconPicker.SelectedItem.ToString(),
                Text            = swipeItemTextEntry.Text
            };

            deleteSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); };

            var leftSwipeItems = new SwipeItems
            {
                deleteSwipeItem
            };

            leftSwipeItems.Mode = SwipeMode.Execute;

            var swipeContent = new Grid
            {
                BackgroundColor = Colors.Gray
            };

            var swipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right"
            };

            swipeContent.Children.Add(swipeLabel);

            var swipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = leftSwipeItems,
                Content       = swipeContent
            };

            swipeLayout.Children.Add(swipeView);

            swipeItemTextEntry.TextChanged += (sender, e) =>
            {
                deleteSwipeItem.Text = swipeItemTextEntry.Text;
            };

            swipeItemBackgroundColorPicker.SelectedIndexChanged += (sender, e) =>
            {
                deleteSwipeItem.BackgroundColor = Color.FromArgb(colors[swipeItemBackgroundColorPicker.SelectedIndex]);
            };

            swipeItemIconPicker.SelectedIndexChanged += (sender, e) =>
            {
                deleteSwipeItem.IconImageSource = swipeItemIconPicker.SelectedItem.ToString();
            };

            Content = swipeLayout;
        }
Example #26
0
 private void RightControl_Invoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
     RightCommandRequested?.Invoke(this, EventArgs.Empty);
 }
Example #27
0
        public AddRemoveSwipeItemsGallery()
        {
            Title = "Add/Remove SwipeItems Gallery";

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var buttonsLayout = new StackLayout
            {
                Orientation = StackOrientation.Horizontal
            };

            var addButton = new Button
            {
                Text = "Add SwipeItem"
            };

            buttonsLayout.Children.Add(addButton);

            var removeButton = new Button
            {
                Text = "Remove SwipeItem"
            };

            buttonsLayout.Children.Add(removeButton);

            var swipeItemIconLabel = new Label
            {
                FontSize = 10,
                Text     = "Choose SwipeItem Icon:"
            };

            var deleteSwipeItem = new SwipeItem
            {
                BackgroundColor = Colors.Orange,
                IconImageSource = "calculator.png",
                Text            = "SwipeItem1"
            };

            deleteSwipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "Delete Invoked", "Ok"); };

            var leftSwipeItems = new SwipeItems
            {
                deleteSwipeItem
            };

            leftSwipeItems.Mode = SwipeMode.Reveal;

            var swipeContent = new Grid
            {
                BackgroundColor = Colors.Gray
            };

            var swipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to Right"
            };

            swipeContent.Children.Add(swipeLabel);

            var swipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = leftSwipeItems,
                Content       = swipeContent
            };

            swipeLayout.Children.Add(buttonsLayout);
            swipeLayout.Children.Add(swipeView);

            Content = swipeLayout;

            addButton.Clicked += (sender, e) =>
            {
                swipeView.Close();

                var swipeItemsCount = swipeView.LeftItems.Count;
                var random          = new Random();

                var newSwipeItem = new SwipeItem
                {
                    BackgroundColor = Color.FromRgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)),
                    IconImageSource = "calculator.png",
                    Text            = $"SwipeItem{swipeItemsCount + 1}"
                };

                swipeView.LeftItems.Add(newSwipeItem);
            };

            removeButton.Clicked += (sender, e) =>
            {
                swipeView.Close();

                var swipeItemsCount = swipeView.LeftItems.Count;

                if (swipeItemsCount > 0)
                {
                    var lastSwipeItem = swipeView.LeftItems.LastOrDefault();
                    swipeView.LeftItems.Remove(lastSwipeItem);
                }
            };
        }
 private void ItemInvoked(SwipeItem sender, SwipeItemInvokedEventArgs args)
 {
     Output.Text = sender.Text;
 }
Example #29
0
        protected override void Init()
        {
            Title = "Issue 10563";

            var swipeLayout = new StackLayout
            {
                Margin = new Thickness(12)
            };

            var openLeftButton = new Button
            {
                AutomationId = OpenLeftId,
                Text         = "Open Left SwipeItem"
            };

            var openRightButton = new Button
            {
                AutomationId = OpenRightId,
                Text         = "Open Right SwipeItem"
            };

            var openTopButton = new Button
            {
                AutomationId = OpenTopId,
                Text         = "Open Top SwipeItem"
            };

            var openBottomButton = new Button
            {
                AutomationId = OpenBottomId,
                Text         = "Open Bottom SwipeItem"
            };

            var closeButton = new Button
            {
                AutomationId = CloseId,
                Text         = "Close SwipeView"
            };

            swipeLayout.Children.Add(openLeftButton);
            swipeLayout.Children.Add(openRightButton);
            swipeLayout.Children.Add(openTopButton);
            swipeLayout.Children.Add(openBottomButton);
            swipeLayout.Children.Add(closeButton);

            var swipeItem = new SwipeItem
            {
                BackgroundColor = Color.Red,
                IconImageSource = "calculator.png",
                Text            = "Issue 10563"
            };

            swipeItem.Invoked += (sender, e) => { DisplayAlert("SwipeView", "SwipeItem Invoked", "Ok"); };

            var swipeItems = new SwipeItems {
                swipeItem
            };

            swipeItems.Mode = SwipeMode.Reveal;

            var swipeContent = new Grid
            {
                BackgroundColor = Color.Gray
            };

            var swipeLabel = new Label
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Text = "Swipe to any direction"
            };

            swipeContent.Children.Add(swipeLabel);

            var swipeView = new SwipeView
            {
                HeightRequest = 60,
                WidthRequest  = 300,
                LeftItems     = swipeItems,
                RightItems    = swipeItems,
                TopItems      = swipeItems,
                BottomItems   = swipeItems,
                Content       = swipeContent,
                Margin        = new Thickness(0, 48)
            };

            swipeLayout.Children.Add(swipeView);

            Content = swipeLayout;

            openLeftButton.Clicked += (sender, e) =>
            {
                swipeView.Open(OpenSwipeItem.LeftItems);
            };

            openRightButton.Clicked += (sender, e) =>
            {
                swipeView.Open(OpenSwipeItem.RightItems);
            };

            openTopButton.Clicked += (sender, e) =>
            {
                swipeView.Open(OpenSwipeItem.TopItems);
            };

            openBottomButton.Clicked += (sender, e) =>
            {
                swipeView.Open(OpenSwipeItem.BottomItems);
            };

            closeButton.Clicked += (sender, e) =>
            {
                swipeView.Close();
            };
        }
Example #30
0
        static SwipeView LoadTemplate()
        {
            var beaconFundingImage = new Image
            {
                Source        = "beaconfundingicon",
                HeightRequest = _rowHeight
            };

            var topicTitleLabel = new Label
            {
                Text                  = "Topic",
                FontAttributes        = FontAttributes.Bold,
                VerticalTextAlignment = TextAlignment.End
            };

            var topicDescriptionLabel = new Label
            {
                VerticalTextAlignment = TextAlignment.Start
            };

            topicDescriptionLabel.SetBinding(Label.TextProperty, nameof(OpportunityModel.Topic));

            var companyTitleLabel = new Label
            {
                Text                  = "Company",
                FontAttributes        = FontAttributes.Bold,
                VerticalTextAlignment = TextAlignment.End
            };

            var companyDescriptionLabel = new Label
            {
                VerticalTextAlignment = TextAlignment.Start
            };

            companyDescriptionLabel.SetBinding(Label.TextProperty, nameof(OpportunityModel.Company));

            var leaseAmountTitleLabel = new Label
            {
                Text                  = "Lease Amount",
                FontAttributes        = FontAttributes.Bold,
                VerticalTextAlignment = TextAlignment.End
            };

            var leaseAmountDescriptionLabel = new Label
            {
                VerticalTextAlignment = TextAlignment.Start
            };

            leaseAmountDescriptionLabel.SetBinding(Label.TextProperty, nameof(OpportunityModel.LeaseAmountAsCurrency));

            var ownerTitleLabel = new Label
            {
                Text                  = "Owner",
                FontAttributes        = FontAttributes.Bold,
                VerticalTextAlignment = TextAlignment.End
            };

            var ownerDescriptionLabel = new Label
            {
                VerticalTextAlignment = TextAlignment.Start
            };

            ownerDescriptionLabel.SetBinding(Label.TextProperty, nameof(OpportunityModel.Owner));

            var grid = new Grid
            {
                BackgroundColor = Color.White,

                Padding = new Thickness(5, 0, 0, 0),

                ColumnSpacing  = 20,
                RowDefinitions =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(_rowHeight / 3, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            grid.Children.Add(beaconFundingImage, 0, 0);
            Grid.SetRowSpan(beaconFundingImage, 2);

            grid.Children.Add(topicTitleLabel, 1, 0);
            grid.Children.Add(topicDescriptionLabel, 1, 1);

            if (Device.Idiom != TargetIdiom.Phone)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });


                grid.Children.Add(companyTitleLabel, 2, 0);
                grid.Children.Add(companyDescriptionLabel, 2, 1);

                grid.Children.Add(leaseAmountTitleLabel, 3, 0);
                grid.Children.Add(leaseAmountDescriptionLabel, 3, 1);

                grid.Children.Add(ownerTitleLabel, 4, 0);
                grid.Children.Add(ownerDescriptionLabel, 4, 1);
            }

            var deleteSwipeItem = new SwipeItem
            {
                Text            = "Delete",
                BackgroundColor = Color.Red,
                Command         = new AsyncCommand <string>(ExecuteSwipeToDeleteCommand)
            };

            deleteSwipeItem.SetBinding(SwipeItem.CommandParameterProperty, nameof(OpportunityModel.Topic));

            var swipeView = new SwipeView
            {
                RightItems = { deleteSwipeItem },
                Content    = grid,
                Margin     = new Thickness(0, 5, 0, 15)
            };

            return(swipeView);
        }