<ui:Page
    x:Class="ModernWpf.SampleApp.ControlPages.PopupPlacementPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ui="http://schemas.modernwpf.com/2019"
    xmlns:sc="clr-namespace:SamplesCommon;assembly=SamplesCommon"
    xmlns:local="clr-namespace:ModernWpf.SampleApp.ControlPages"
    mc:Ignorable="d">
    <ScrollViewer>
        <ui:SimpleStackPanel Style="{StaticResource ControlPageContentPanelStyle}">
            <sc:ControlExample HeaderText="Popup placement">
                <Grid>
                    <ToggleButton
                        x:Name="Control1"
                        Content="Open/close popup"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center" />
                    <Popup
                        x:Name="Popup1"
                        AllowsTransparency="True"
                        Placement="Absolute"
                        PlacementTarget="{Binding ElementName=Control1}"
                        IsOpen="{Binding ElementName=Control1, Path=IsChecked}">
                        <Border>
                            <ui:ThemeShadowChrome>
                                <Border
                                    Background="{DynamicResource AcrylicBackgroundFillColorDefaultBrush}"
                                    BorderBrush="{DynamicResource SystemControlHighlightAccentBrush}"
                                    BorderThickness="5"
                                    Width="100"
                                    Height="100" />
                            </ui:ThemeShadowChrome>
                        </Border>
                    </Popup>
                </Grid>
                <sc:ControlExample.Options>
                    <ui:SimpleStackPanel Style="{StaticResource OptionsPanelStyle}">
                        <ui:RadioButtons
                            Header="Placement"
                            ItemsSource="{Binding Source={x:Type PlacementMode}, Converter={StaticResource EnumValuesConverter}}"
                            SelectedItem="{Binding ElementName=Popup1, Path=Placement}" />
                    </ui:SimpleStackPanel>
                </sc:ControlExample.Options>
            </sc:ControlExample>
        </ui:SimpleStackPanel>
    </ScrollViewer>
</ui:Page>
