<Page x:Class="SdbS.View_Manager.Pages.TypeMachines"
      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:local="clr-namespace:SdbS.View_Manager.Pages"
      mc:Ignorable="d" 
      d:DesignHeight="450" 
      d:DesignWidth="800"
      Title="TypeMachines">

    <!--Кастомный ListBox-->
    <Page.Resources>
        <DataTemplate x:Key="CustomListBox">
            <Grid Background="#FFEFF5F7">

                <Label Content="{Binding Name}"
                       Grid.Column="0"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       BorderBrush="#FF4CB034"
                       BorderThickness="1"
                       Width="605"
                       Margin="5"/>

            </Grid>
        </DataTemplate>
    </Page.Resources>

    <!--Сетка 'ОСНОВНОЙ ЧАСТИ'-->
    <Grid Background="White">

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

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="150"/>
        </Grid.ColumnDefinitions>

        <!--Кнопка выхода в начальное меню-->
        <Button Name="button_BrowseBack"
                Content="Назад"
                Grid.Row="0"
                Grid.Column="0"
                Margin="5"
                Background="#FFEFF5F7"
                BorderBrush="#FF4CB034"
                BorderThickness="2"
                Padding="3"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                Command="NavigationCommands.BrowseBack">

            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" 
                                Value="5"/>
                </Style>
            </Button.Resources>

        </Button>

        <!--Сетка части 'ОТОБРАЖЕНИЕ ДАННЫХ'-->
        <Grid Grid.Row="1"
              Grid.Column="0">

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

            <!--Отображаемый список из таблицы-->
            <GroupBox Grid.Row="0"
                      Header="Типы станков"
                      BorderBrush="Black"
                      BorderThickness="2"
                      Margin="5">

                <Grid>

                    <ListBox Grid.Row="1"
                             ItemTemplate="{DynamicResource CustomListBox}" 
                             Name="listBox_TypeMachines"
                             BorderThickness="0"
                             d:ItemsSource="{d:SampleData ItemCount=3}"/>
                </Grid>

            </GroupBox>

            <!--Отображение общего количества записей-->
            <TextBlock Grid.Row="1"
                       Text="Общее количество записей"
                       Margin="10 0 0 0"
                       VerticalAlignment="Top"
                       HorizontalAlignment="Left"/>
            <TextBlock Grid.Row="1"
                       Name="textBlock_AllCountRecords"
                       Text="(...)"
                       Foreground="#FF4CB034"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Top"
                       Margin="165 0 0 0"/>

        </Grid>

        <!--Сетка части 'МАНИПУЛЯЦИИ'-->
        <Grid Grid.Row="1"
              Grid.Column="1">

            <Grid.RowDefinitions>
                <RowDefinition Height="150"/>
                <RowDefinition Height="160"/>
                
            </Grid.RowDefinitions>

            <!--Поле с манипуляцией названия станка-->
            <TextBlock Text="Название типа:"
                       Grid.Row="0"
                       VerticalAlignment="Center"
                       HorizontalAlignment="Left"
                       Margin="5 0 0 0"
                       Foreground="White"
                       Background="#FF4CB034"
                       Padding="5 0 5 3"/>
            <TextBox Name="textBox_NameType"
                     Grid.Row="0"
                     VerticalAlignment="Center"
                     HorizontalAlignment="Center"
                     Height="20"
                     Width="140"
                     Background="#FFEFF5F7"
                     BorderThickness="1"
                     BorderBrush="#FF4CB034"
                     Margin="0 50 0 0"/>

            <!--Действия (функциональные клавиши)-->
            <GroupBox Grid.Row="1"
                      Margin="5"
                      Header="Действия"
                      BorderBrush="#FF4CB034"
                      BorderThickness="2">

                <!--Сетка для части 'ФУНКЦИОНАЛЬНЫЕ КЛАВИШИ'-->
                <Grid>

                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <Button Name="button_AddTypeMachine"
                            Grid.Row="0"
                            Background="#FFEFF5F7"
                            BorderThickness="2"
                            BorderBrush="#FF4CB034"
                            Padding="0 3 0 3"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Content="Добавить"
                            Width="100" 
                            Click="button_AddTypeMachine_Click">
                        <Button.Resources>
                            <Style TargetType="Border">
                                <Setter Property="CornerRadius" 
                                Value="5"/>
                            </Style>
                        </Button.Resources>
                    </Button>


                    <Button Name="button_DeleteTypeMachine"
                            Grid.Row="1"
                            Background="#FFEFF5F7"
                            BorderThickness="2"
                            BorderBrush="#FF4CB034"
                            Padding="0 3 0 3"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Content="Удалить"
                            Width="100" 
                            Click="button_DeleteTypeMachine_Click">
                        <Button.Resources>
                            <Style TargetType="Border">
                                <Setter Property="CornerRadius" 
                                Value="5"/>
                            </Style>
                        </Button.Resources>
                    </Button>

                    <Button Name="button_DropFields"
                            Grid.Row="2"
                            Background="#FFEFF5F7"
                            BorderThickness="2"
                            BorderBrush="#FF4CB034"
                            Padding="0 3 0 3"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Width="100"
                            Content="Сброс" 
                            Click="button_DropFields_Click">
                        <Button.Resources>
                            <Style TargetType="Border">
                                <Setter Property="CornerRadius" 
                                Value="5"/>
                            </Style>
                        </Button.Resources>
                    </Button>

                </Grid>

            </GroupBox>

        </Grid>

    </Grid>
</Page>
