Getting Started

This article will guide you through the steps needed to add a basic RadPopup control in your application.

1. Setting up the app

Take a look at these articles and follow the instructions to setup your app:

2. Adding the required Telerik references

You have two options:

  • Add the Telerik UI for Xamarin Nuget packages following the instructions in Telerik NuGet package server topic.

  • Add the references to Telerik assemblies manually, check the list below with the required assemblies for RadPopup component:

Platform Assemblies
Portable Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.Primitives.dll
Android Telerik.Xamarin.Android.Common.dll
Telerik.Xamarin.Android.Primitives.dll
Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.Primitives.dll
iOS Telerik.Xamarin.iOS.dll
Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.Primitives.dll
UWP Telerik.Core.dll
Telerik.UI.Xaml.Primitives.UWP.dll
Telerik.XamarinForms.Common.dll
Telerik.XamarinForms.Primitives.dll

3. Adding RadPopup control

You could use one of the following approaches:

Drag the control from the Toolbox.

Take a look at the following topics on how to use the toolbox:

Create the control definition in XAML or C#.

The snippet below shows a simple RadPopup definition:

<Button HorizontalOptions="Center" 
        VerticalOptions="Start" 
        Text="Click here to rate" 
        Clicked="ShowPopup">
    <telerikPrimitives:RadPopup.Popup>
        <telerikPrimitives:RadPopup x:Name="popup"
                                    IsModal="True"
                                    OutsideBackgroundColor="#6F000000">
            <telerikPrimitives:RadBorder CornerRadius="8" 
                                         BackgroundColor="Wheat">
                <Grid Padding="20">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="30" />
                        <RowDefinition Height="20" />
                        <RowDefinition Height="40" />
                    </Grid.RowDefinitions>
                    <Label Text="Please rate your experience" />
                    <telerikInput:RadShapeRating Grid.Row="1" />
                    <Button Grid.Row="2"
                            Padding="2"
                            HorizontalOptions="End" 
                            Text="Send" 
                            Clicked="ClosePopup" />
                </Grid>
            </telerikPrimitives:RadBorder>
        </telerikPrimitives:RadPopup>
    </telerikPrimitives:RadPopup.Popup>
</Button>
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;

and here are the referenced event handlers:

private void ClosePopup(object sender, EventArgs e)
{
    popup.IsOpen = false;
}
private void ShowPopup(object sender, EventArgs e)
{
    popup.IsOpen = true;
}

In addition to this, you need to add the following namespace:

xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
using Telerik.XamarinForms.Primitives;

This is the result:

RadPopup

SDK Browser and QSF applications contain different examples that show RadPopup's main features. You can find the applications in the Examples and QSF folders of your local Telerik UI for Xamarin installation.

See Also

In this article
Not finding the help you need? Improve this article