Xceed Toolkit for .NET Maui v2.0 Documentation
Xceed.Maui.Toolkit Assembly / Xceed.Maui.Toolkit Namespace / Popup Class
Members Example


In This Topic
    Popup Class
    In This Topic
    Represents a popup window that appears over the application.
    Syntax
    'Usage
     
    
    Dim instance As Popup
    Remarks

    The Popup can use any View as its Content and can be modal or not. It can be positioned on any side or corner relative to the Window, the Popup's parent or a View that serves as an anchor.

    Note that it can be useful to define a Popup within the code beforehand & then display it when needed.

    For xaml definition, a PopupContainer can be used.

    Example

    In the following example, a Popup is created & then opened when a Button is clicked. The opened Popup is positioned at the bottom right of the sender, which in this case is said Button. The Popup's Content is made of a Border containing a Label that displays some text.

    Visually, the code below would display this control:

    private void Button_Clicked( object sender, EventArgs e )
    {
      var contentBorder = new Border()
      {
        Background = Colors.LightGray,
        BorderBrush = Colors.Orange,
        BorderThickness = 3,
        Content = new Label() { Text = "My Popup...", TextColor = Colors.Red }
      };
    
      var popup = new Popup()
      {
        Content = contentBorder,
        IsModal = false,
        Anchor = sender as View,
        HorizontalOptions = LayoutOptions.End,
        VerticalOptions = LayoutOptions.End
      };
    
      popup.Open();
    }
    Inheritance Hierarchy

    System.Object
       Microsoft.Maui.Controls.BindableObject
          Microsoft.Maui.Controls.Element
             Microsoft.Maui.Controls.NavigableElement
                Microsoft.Maui.Controls.VisualElement
                   Microsoft.Maui.Controls.View
                      Xceed.Maui.Toolkit.Popup

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also