<UserControl
    x:Class="Ursa.Demo.Pages.DialogDemo"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:u="https://irihi.tech/ursa"
    xmlns:vm="using:Ursa.Demo.ViewModels"
    d:DesignHeight="450"
    d:DesignWidth="800"
    x:CompileBindings="True"
    x:DataType="vm:DialogDemoViewModel"
    mc:Ignorable="d">
    <Grid ColumnDefinitions="Auto, *">
        <TabControl Grid.Column="0" Width="300">
            <TabItem Header="Default">
                <StackPanel>
                    <ToggleSwitch
                        Name="overlay"
                        Content="Window/Overlay"
                        IsChecked="{Binding IsWindow}"
                        OffContent="Overlay"
                        OnContent="Window" />
                    <ToggleSwitch
                        Content="Global/Local"
                        IsChecked="{Binding IsGlobal}"
                        IsVisible="{Binding !#overlay.IsChecked}"
                        OffContent="Local"
                        OnContent="Global" />
                    <ToggleSwitch
                        Name="defaultModal"
                        Content="Modal/Regular"
                        IsChecked="{Binding IsModal}"
                        IsVisible="{Binding !#overlay.IsChecked}"
                        OffContent="Regular"
                        OnContent="Modal" />
                    <ToggleSwitch
                        Content="ClickOnMaskToClose"
                        IsChecked="{Binding CanCloseMaskToClose}"
                        IsVisible="{Binding #defaultModal.IsChecked}"
                        OffContent="No"
                        OnContent="Yes" />
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Buttons" />
                        <ComboBox ItemsSource="{Binding Buttons}" SelectedItem="{Binding SelectedButton}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Mode" />
                        <ComboBox ItemsSource="{Binding Modes}" SelectedItem="{Binding SelectedMode}" />
                    </StackPanel>
                    <Button Command="{Binding ShowDialogCommand}" Content="Show Dialog" />
                    <TextBlock>
                        <Run Text="Default Result: " />
                        <Run Text="{Binding DefaultResult}" />
                    </TextBlock>
                    <TextBlock>
                        <Run Text="Dialog Date: " />
                        <Run Text="{Binding Date}" />
                    </TextBlock>
                </StackPanel>
            </TabItem>
            <TabItem Header="Custom">
                <StackPanel>
                    <ToggleSwitch
                        Name="overlay2"
                        Content="Window/Overlay"
                        IsChecked="{Binding IsWindow}"
                        OffContent="Overlay"
                        OnContent="Window" />
                    <ToggleSwitch
                        Content="Global/Local"
                        IsChecked="{Binding IsGlobal}"
                        IsVisible="{Binding !#overlay2.IsChecked}"
                        OffContent="Local"
                        OnContent="Global" />
                    <ToggleSwitch
                        Content="Modal/Regular"
                        Name="modal"
                        IsChecked="{Binding IsModal}"
                        OffContent="Regular"
                        OnContent="Modal" />
                    <ToggleSwitch
                        Content="ClickOnMaskToClose"
                        IsChecked="{Binding CanCloseMaskToClose}"
                        IsVisible="{Binding #modal.IsChecked}"
                        OffContent="No"
                        OnContent="Yes" />
                    <Button Command="{Binding ShowCustomDialogCommand}" Content="Show Dialog" />
                    <TextBlock>
                        <Run Text="Custom Result: " />
                        <Run Text="{Binding Result}" />
                    </TextBlock>
                    <TextBlock>
                        <Run Text="Dialog Date: " />
                        <Run Text="{Binding Date}" />
                    </TextBlock>
                </StackPanel>
            </TabItem>
        </TabControl>
        <Grid Grid.Column="1">
            <Border
                BorderBrush="{DynamicResource SemiGrey1}"
                BorderThickness="1"
                ClipToBounds="True"
                CornerRadius="20">
                <u:OverlayDialogHost HostId="LocalHost">
                    <u:OverlayDialogHost.DialogDataTemplates>
                        <DataTemplate DataType="x:String">
                            <TextBlock
                                Margin="24,24,48,24"
                                Foreground="Red"
                                Text="{Binding Path=.}" />
                        </DataTemplate>
                    </u:OverlayDialogHost.DialogDataTemplates>
                </u:OverlayDialogHost>
            </Border>
        </Grid>
    </Grid>
</UserControl>
