コード例 #1
0
        private void TypeSelectorButton_Clicked(object sender, EventArgs e)
        {
            ImageButton phoneType = (ImageButton)sender;
            RadPopup    popup     = phoneType.FindByName <RadPopup>("PhoneTypePopup");

            popup.IsOpen = true;
        }
コード例 #2
0
        private void HomeTypeButton_Clicked(object sender, EventArgs e)
        {
            ImageButton ib = (ImageButton)sender;
            ImageButton typeSelectorButton = (ImageButton)ib.Parent.Parent.Parent.Parent;
            Phone       phone = typeSelectorButton.BindingContext as Phone;
            RadPopup    popup = typeSelectorButton.FindByName <RadPopup>("PhoneTypePopup");

            popup.IsOpen = false;

            if (phone != null)
            {
                UpdateViewTypeHelper(typeSelectorButton, phone, Phone.Type.HOME); return;
            }

            Email email = typeSelectorButton.BindingContext as Email;

            if (email != null)
            {
                UpdateViewTypeHelper(typeSelectorButton, email, Email.Type.PERSONAL); return;
            }

            Address address = typeSelectorButton.BindingContext as Address;

            if (address != null)
            {
                UpdateViewTypeHelper(typeSelectorButton, address, Address.Type.PERSONAL); return;
            }
        }
コード例 #3
0
        private void ShowModal(ModalViewModel viewModel)
        {
            Page    page    = null;
            Element element = this;

            while (page == null && element != null)
            {
                element = element.Parent;
                page    = element as Page;
            }

            if (page != null)
            {
                if (this.popupContent == null)
                {
                    this.popupContent = (View)((ControlTemplate)this.Resources["PopupTemplate"]).CreateContent();
                    this.popupContent.BindingContextChanged += this.PopupContent_BindingContextChanged;
                }

                if (this.popup == null)
                {
                    this.popup         = new RadPopup();
                    this.popup.Content = this.popupContent;
                    this.popup.IsModal = true;
                    this.popup.OutsideBackgroundColor = Color.FromHex("6F000000");
                    this.popup.Placement     = PlacementMode.Center;
                    this.popup.AnimationType = PopupAnimationType.Zoom;
                }

                this.popup.IsOpen = true;
            }
        }
コード例 #4
0
        private async void GetHTML_Clicked(object sender, EventArgs e)
        {
            // >> richtexteditor-keyfeatures-gethtml
            var htmlString = await this.richTextEditor.GetHtmlAsync();

            // << richtexteditor-keyfeatures-gethtml

            var popup = new RadPopup {
                OutsideBackgroundColor = Color.FromHex("#6F000000")
            };

            popup.PlacementTarget = this;

            var containerGrid = new Grid {
                Padding = 20
            };

            containerGrid.Children.Add(new Label {
                Text = htmlString
            });

            var border = new RadBorder {
                CornerRadius = new Thickness(8), BackgroundColor = Color.Wheat
            };

            border.Content = containerGrid;
            popup.Content  = border;
            popup.IsOpen   = true;
        }
コード例 #5
0
 public FirstLookView()
 {
     InitializeComponent();
     this.viewModel       = new FirstLookViewModel();
     this.BindingContext  = this.viewModel;
     this.popup           = new RadPopup();
     this.popup.Placement = PlacementMode.Center;
 }
コード例 #6
0
        public PopupGettingStartedCSharp()
        {
            // >> popup-getting-started-csharp
            var showPopupBtn = new Button {
                HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Text = "Click here to rate"
            };

            showPopupBtn.Clicked += ShowPopup;

            popup = new RadPopup {
                IsModal = true, OutsideBackgroundColor = Color.FromHex("#6F000000")
            };
            popup.PlacementTarget = showPopupBtn;

            var containerGrid = new Grid {
                Padding = 20
            };

            containerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(30)
            });
            containerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(20)
            });
            containerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(40)
            });
            containerGrid.Children.Add(new Label {
                Text = "Please rate your experience"
            });

            var rating = new RadShapeRating();

            rating.SetValue(Grid.RowProperty, 1);
            containerGrid.Children.Add(rating);

            var hidePopupBtn = new Button {
                Padding = new Thickness(2), HorizontalOptions = LayoutOptions.End, Text = "Send"
            };

            hidePopupBtn.SetValue(Grid.RowProperty, 2);
            hidePopupBtn.Clicked += ClosePopup;
            containerGrid.Children.Add(hidePopupBtn);

            var border = new RadBorder {
                CornerRadius = new Thickness(8), BackgroundColor = Color.Wheat
            };

            border.Content = containerGrid;
            popup.Content  = border;
            // << popup-getting-started-csharp

            this.Content = showPopupBtn;
        }
コード例 #7
0
        private void DismissPopup()
        {
            if (this.hintPopup == null)
            {
                return;
            }

            this.hintPopup.PlacementTarget  = null;
            this.hintPopup.PropertyChanged -= this.OnHintPopupPropertyChanged;
            this.hintPopup = null;
        }
コード例 #8
0
        private void InitializeHintPopup()
        {
            this.hintPopup         = new RadPopup();
            this.hintPopup.IsModal = false;
            this.hintPopup.OutsideBackgroundColor = Color.FromHex("#BF4B4C4C");
            this.hintPopup.PlacementTarget        = this.appBarMiddleButton;
            this.hintPopup.PropertyChanged       += this.OnHintPopupPropertyChanged;

            var hintImage = new Image();

            hintImage.Margin            = new Thickness(0, 0, 30, 0);
            hintImage.HorizontalOptions = LayoutOptions.End;
            hintImage.VerticalOptions   = LayoutOptions.Start;

            hintImage.Source = Device.RuntimePlatform == Device.UWP
                ? new FileImageSource()
            {
                File = @"Assets\Config_Text.png"
            }
                : new FileImageSource()
            {
                File = "Config_Text.png"
            };

            var imageTapGestureRecognizer = new TapGestureRecognizer();

            imageTapGestureRecognizer.Command = new Command(() => this.SetValueCore(AppBar.IsHintOpenProperty, false));
            hintImage.GestureRecognizers.Add(imageTapGestureRecognizer);

            var popupContent = new Grid();

            popupContent.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Star
            });

            if (Device.RuntimePlatform == Device.UWP)
            {
                popupContent.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(2, GridUnitType.Star),
                });
            }

            popupContent.Children.Add(hintImage);
            Grid.SetRow(hintImage, 0);

            this.hintPopup.Content = popupContent;
            this.hintPopup.IsOpen  = true;
        }
コード例 #9
0
        public PopupPlacementCSharp()
        {
            // >> popup-features-placement-code
            var myButton = new Button()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.StartAndExpand,
                BackgroundColor   = Color.FromHex("#7A9BFF"),
                TextColor         = Color.White,
                Text = "Show popup",
            };

            var popup = new RadPopup()
            {
                Placement        = PlacementMode.Bottom,
                HorizontalOffset = 20,
                VerticalOffset   = 20,
                PlacementTarget  = myButton
            };

            myButton.Clicked += ((sender, args) => { popup.IsOpen = true; });

            popup.Content = new RadBorder()
            {
                WidthRequest    = 180,
                CornerRadius    = new Thickness(6),
                BackgroundColor = Color.FromHex("#93D7FF"),
                BorderColor     = Color.FromHex("#7A9BFF"),
                Padding         = new Thickness(10),
                Content         = new Label()
                {
                    Text = "With Telerik Popup for Xamarin you could easily add modal popups to your application in order to draw attention to important information or receive user input."
                }
            };

            this.Content = new Grid()
            {
                Margin   = new Thickness(10),
                Children = { myButton }
            };
            // << popup-features-placement-code
        }
コード例 #10
0
 public ContentPopupConfirm(Telerik.XamarinForms.Primitives.RadPopup popup)
 {
     InitializeComponent();
     this._popup = popup;
 }