<?xml version="1.0" encoding="utf-8"?>
<UserControl
    x:Class="Sonex.Client.Controls.ToolBarGroup"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    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"
    Margin="0"
    VerticalAlignment="Stretch"
    mc:Ignorable="d">

    <Grid VerticalAlignment="Stretch">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <Grid x:Name="_ExpandedRoot" Grid.Column="0" Margin="8,0,8,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ContentPresenter x:Name="_InlineContentPresenter" Grid.Row="0" />

            <TextBlock
                Grid.Row="2"
                Margin="0,3,0,0"
                HorizontalAlignment="Center"
                FontSize="11"
                Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                Text="{x:Bind Title, Mode=OneWay}"
                TextAlignment="Center" />
        </Grid>

        <Grid x:Name="_CompactRoot" Grid.Column="0" Margin="8,0,8,0" Visibility="Collapsed">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Button
                x:Name="_CompactButton"
                Grid.Row="0"
                Content="⋯"
                Click="CompactButton_Click"
                ToolTipService.ToolTip="{x:Bind Title, Mode=OneWay}">
                <Button.Flyout>
                    <Flyout x:Name="_CompactFlyout" Closed="CompactFlyout_Closed" Placement="Bottom">
                        <Border Padding="8" Background="{ThemeResource SolidBackgroundFillColorBaseBrush}">
                            <ScrollViewer
                                HorizontalScrollMode="Auto"
                                HorizontalScrollBarVisibility="Auto"
                                VerticalScrollMode="Auto"
                                VerticalScrollBarVisibility="Auto"
                                MinWidth="220"
                                MaxHeight="420">
                                <ContentPresenter x:Name="_FlyoutContentPresenter" />
                            </ScrollViewer>
                        </Border>
                    </Flyout>
                </Button.Flyout>
            </Button>

            <TextBlock
                Grid.Row="2"
                Margin="0,3,0,0"
                HorizontalAlignment="Center"
                FontSize="11"
                Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                Text="{x:Bind Title, Mode=OneWay}"
                TextAlignment="Center" />

        </Grid>

        <Rectangle
            Grid.Column="1"
            Width="1"
            Fill="{ThemeResource ControlStrokeColorDefaultBrush}" />
    </Grid>
</UserControl>
