<detailspagebase:SupportCasePageBase
        xmlns:detailspagebase="clr-namespace:FasdDesktopUi.Pages"
        x:Class="FasdDesktopUi.Pages.SlimPage.SlimPageView"
        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"
        xmlns:local="clr-namespace:FasdDesktopUi.Pages.SlimPage"
        xmlns:uc="clr-namespace:FasdDesktopUi.Pages.SlimPage.UserControls"
        xmlns:buc="clr-namespace:FasdDesktopUi.Basics.UserControls"
        xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
        mc:Ignorable="d"
        Title="FASD Slim"
        x:Name="SlimPage"
        PreviewKeyDown="Window_PreviewKeyDown"
        Closing="Window_Closing"
        AllowsTransparency="True"
        WindowStyle="None"
        Background="Transparent"
        VerticalAlignment="Bottom"
        ResizeMode="CanMinimize"
        WindowState="Maximized"
        ShowInTaskbar="False"
        Topmost="True" Loaded="SlimPage_Loaded">
    <Window.DataContext>
        <local:SlimPageViewModel />
    </Window.DataContext>

    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
        <vc:NullValueToVisibilityConverter x:Key="NullToVisibility" />
        <vc:PercentToDecimalConverter x:Key="PercentToDecimal" />
    </Window.Resources>

    <Border x:Name="MainBorder"
            Background="#01000000"
            MinWidth="360"
            Padding="10"
            HorizontalAlignment="Right"
            VerticalAlignment="Bottom">
        <Border.LayoutTransform>
            <ScaleTransform ScaleX="{Binding ZoomInPercent, Converter={StaticResource PercentToDecimal}}"
                            ScaleY="{Binding ZoomInPercent, Converter={StaticResource PercentToDecimal}}"
                            CenterX="0"
                            CenterY="0" />
        </Border.LayoutTransform>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Border x:Name="Header"
                    Grid.Row="0">
                <uc:SlimPageWindowStateBar ClickedClose="WindowStateBarUc_ClickedClose"
                                           ClickedMaximize="WindowStateBarUc_ClickedMaximize"
                                           ShowFullStateBar="True"
                                           Visibility="{Binding ElementName=MainBorder, Path=IsMouseOver, Converter={StaticResource BoolToVisibility}}" />
            </Border>

            <Border x:Name="Body"
                    Grid.Row="1">
                <Grid x:Name="BodyGrid">

                    <Border x:Name="StaticBodyParts"
                            VerticalAlignment="Bottom"
                            Panel.ZIndex="0">
                        <StackPanel>
                            <uc:SlimPageDataHistoryCollection x:Name="DataHistoryCollectionUc" />
                            <uc:SlimPageWidgetCollection x:Name="WidgetCollectionUc"
                                                         HeadingData="{Binding HeadingData}"
                                                         WidgetData="{Binding WidgetData}"
                                                         Width="{Binding ElementName=BodyGrid, Path=ActualWidth}" />
                        </StackPanel>
                    </Border>

                    <Border x:Name="BlurBorderBody"
                            Background="Transparent"
                            Panel.ZIndex="1"
                            Visibility="{Binding ElementName=SlimPage, Path=IsBlurred, Converter={StaticResource BoolToVisibility}}"
                            MouseUp="BlurBorder_MouseUp"
                            TouchDown="BlurBorder_TouchDown" />

                    <Border x:Name="DynamicBodyParts" x:FieldModifier="private"
                            Width="{Binding ElementName=StaticBodyParts, Path=ActualWidth}"
                            Panel.ZIndex="2"
                            VerticalAlignment="Bottom"
                            Margin="0 2.5 0 0"
                            CornerRadius="10 10 0 0"
                            Background="{DynamicResource BackgroundColor.Menu.Categories}" />

                </Grid>
            </Border>

            <Border x:Name="Footer" x:FieldModifier="private"
                    Grid.Row="2"
                    Background="{DynamicResource BackgroundColor.SlimPage.MenuBar}"
                    CornerRadius="0 0 7.5 7.5"
                    Padding="10">
                <Grid>
                    <buc:MenuBar x:Name="MenuBarUc" x:FieldModifier="private" />
                    <buc:SearchBar x:Name="SearchBarUserControl" x:FieldModifier="private"
                        Visibility="Collapsed"
                        />
                </Grid>

            </Border>

        </Grid>

    </Border>
</detailspagebase:SupportCasePageBase>
