<Window x:Class="ImageResizerGUI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Image Resizer" Height="600" Width="800" Icon="/ImageResizerGUI;component/Images/image1.png">
    <Grid>

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

            <Border Margin="4" Padding="4" BorderBrush="Gray" BorderThickness="1" CornerRadius="2">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>

                    <TextBlock Text="Select Files"  Margin="0,5,0,0"/>

                    <StackPanel Grid.Row="1" Orientation="Vertical" Margin="5">
                        <Button x:Name="btn_addFiles" Content="Add Files" Margin="5,3"/>
                        <Button x:Name="btn_addFolder" Content="Add Folder" Margin="5,3" Click="btn_addFolder_Click" />
                        <Button x:Name="btn_remove" Content="Remove" Margin="5,3"/>
                        <Button x:Name="btn_clearAll" Content="Clear All" Margin="5,3"/>
                    </StackPanel>

                    <DataGrid x:Name="listView" Grid.Column="1" Grid.Row="1" Margin="0,0,10,0"
                             ItemsSource="{Binding}" AutoGenerateColumns="False" CanUserReorderColumns="False" IsSynchronizedWithCurrentItem="true" HorizontalGridLinesBrush="#FFC1C1C1" VerticalGridLinesBrush="#FFC1C1C1" AllowDrop="True">
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="File Name" Binding="{Binding FileName}" IsReadOnly="True" />
                            <DataGridTextColumn Header="Folder" Binding="{Binding Folder}" IsReadOnly="True" />
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </Border>

            <Border Grid.Row="1" Margin="4" Padding="4" BorderBrush="Gray" BorderThickness="1" CornerRadius="2">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>

                    <Grid Grid.Row="0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>

                        <TextBlock Text="Choose Options"  Margin="0,5,0,0"/>

                        <Grid Grid.Row="1" Margin="0,10">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                            </Grid.RowDefinitions>

                            <StackPanel Orientation="Horizontal">
                                <Grid> 
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                        <ColumnDefinition Width="auto"/>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Grid.Row="1" Grid.Column="0" Text="Height" Margin="5,0" VerticalAlignment="Center"/>
                                    <TextBox Grid.Row="1" Grid.Column="1" x:Name="tbox_height" x:FieldModifier="public" Width="50" VerticalAlignment="Center" Text="768" Margin="0,2"/>
                                    <TextBlock Grid.Row="1" Grid.Column="2" Text="px" Margin="5,0" VerticalAlignment="Center"/>

                                    <TextBlock Grid.Row="0" Grid.Column="0" Text="Width" Margin="5,0" VerticalAlignment="Center"/>
                                    <TextBox Grid.Row="0" Grid.Column="1" x:Name="tbox_width" x:FieldModifier="public" Width="50" VerticalAlignment="Center" Text="1024" Margin="0,2"/>
                                    <TextBlock Grid.Row="0" Grid.Column="2" Text="px" Margin="5,0" VerticalAlignment="Center"/>
                                </Grid>


                                <Button Content="Advanced Options" Margin="5,0" VerticalAlignment="Center" Click="Button_Click_2" />
                            </StackPanel>
                           
                        </Grid>
                    </Grid>

                    <Grid Grid.Row="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto"/>
                            <RowDefinition Height="auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>

                        <StackPanel Grid.Row="1" Orientation="Horizontal">
                            <TextBlock Text="Export Action" Margin="0,0,10,0" VerticalAlignment="Center"/>
                            <ComboBox x:Name="comboBox_exportAction" SelectedIndex="1" Margin="5">
                                <ComboBoxItem Content="Modify Existing"/>
                                <ComboBoxItem Content="Export Results"/>
                                <ComboBoxItem Content="Create Zip File"/>
                            </ComboBox>
                        </StackPanel>

                        <Grid x:Name="grid_exportResults" Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBox x:Name="tbox_savePath" Margin="0,5"/>
                            <Button x:Name="btn_BrowseButton" Grid.Column="1" Content="Browse" Margin="10,5" Width="90"/>
                        </Grid>

                    </Grid>

                </Grid>
            </Border>

            <Grid Grid.Row="2">
                <TextBlock x:Name="tblock_errorMsg" Foreground="Red" Text="Error text" Margin="4" Padding="4" Visibility="Collapsed"/>
            </Grid>
            <Grid Grid.Row="3">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button x:Name="btn_showResults" Content="Show Results" Visibility="Collapsed" Width="200" Margin="10,5" Click="btn_showResults_Click" />
                    <Button x:Name="btn_resize" Content="Resize"  Width="200" Margin="10,5" Click="btn_resize_Click" />
                </StackPanel>
            </Grid>
        </Grid>

        <Grid x:Name="gridResults" Visibility="Collapsed" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>

            <Border BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Margin="5" Padding="5" Background="White">
                <DataGrid x:Name="dataGridResults" Grid.Column="1" Grid.Row="1" 
                             ItemsSource="{Binding}" AutoGenerateColumns="False" CanUserReorderColumns="False" HorizontalGridLinesBrush="#FFC1C1C1" VerticalGridLinesBrush="#FFC1C1C1">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="File Name" Binding="{Binding FileName}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Folder" Binding="{Binding Folder}" IsReadOnly="True" />
                        <DataGridTemplateColumn Header="Progress">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <ProgressBar Value="{Binding Path=Status}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Header="Status">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding StatusText}" Foreground="{Binding Color}"/>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </Border>

            <Grid Grid.Row="1" x:Name="gridStatus">
                <StatusBar HorizontalAlignment="Stretch">
                    <Grid HorizontalAlignment="Stretch">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="auto"/>
                        </Grid.ColumnDefinitions>
                        <StatusBarItem Grid.Column="0">
                            <TextBlock Name="tbStatus">Status:</TextBlock>
                        </StatusBarItem>

                        <StatusBarItem Grid.Column="1">
                            <ProgressBar Height="12" Width="300" Margin="20,0,5,1" Visibility="Hidden" Name="pBar1" VerticalAlignment="Bottom" />
                        </StatusBarItem>

                        <StatusBarItem Grid.Column="2">
                            <Button Height="24" Width="80" Content="Cancel" Name="btnCancel" Visibility="Hidden" Click="btnCancel_Click" />
                        </StatusBarItem>
                    </Grid>
                </StatusBar>
            </Grid>

            <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button x:Name="btn_back" Content="Back" HorizontalAlignment="Right" Width="100" Margin="5" Click="Button_Click_1" />
                <Button x:Name="btn_viewResults" Content="View Results" HorizontalAlignment="Right" Width="100" Margin="5" Click="btn_viewResults_Click" />
            </StackPanel>
        </Grid>


    </Grid>

</Window>
