<Window x:Class="FileAttachments.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:PageViewWPF="clr-namespace:O2S.Components.PDFView4NET.WPF;assembly=O2S.Components.PDFView4NET.WPF"
    Title="PDFView4NET - File attachments" Height="450" Width="700">
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!--First row-->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>

            <!--PDF file-->
            <Label Content="PDF file:"/>
            <TextBox Grid.Column="1" Margin="2" Name="FilePathTextBox" IsEnabled="False"/>
            <Button Grid.Column="2" Margin="2" Width="30" Content="..." Click="Browse_Click"/>
        </Grid>
        
        <!--PDFPageView-->
        <PageViewWPF:PDFPageView Grid.Row="1" Name="PdfControl" Margin="0" BorderThickness="1" BorderBrush="Black"/>

        <GridSplitter Grid.Row="2" Height="10" Background="Gray" HorizontalAlignment="Stretch"/>
        
        <!--Last row with buttons-->
        <Grid Grid.Row="3">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*" MinHeight="100"/>
            </Grid.RowDefinitions>
            
            <!--Buttons-->
            <StackPanel Orientation="Horizontal">
                <Button Margin="4" Width="120" Content="Add attachment" Click="AddAttachment_Click"/>
                <Button Margin="4" Width="120" Content="Edit description" Click="EditDescription_Click"/>
                <Button Margin="4" Width="120" Content="Save attachment" Click="SaveAttachment_Click"/>
                <Button Margin="4" Width="120" Content="Remove attachment" Click="RemoveAttachment_Click"/>
            </StackPanel>
            <Button Margin="4" Width="120" HorizontalAlignment="Right" Content="Save document" Click="SaveDocument_Click"/>

            <!--Details listview-->
            <ListView Grid.Row="1" ItemsSource="{Binding FileAttachments, Mode=OneWay}" Name="DetailsListView">
                <ListView.View>
                    <GridView AllowsColumnReorder="true">
                        <GridViewColumn Header="File name" Width="120" DisplayMemberBinding="{Binding Path=FileName}" />
                        <GridViewColumn Header="Description" Width="200" DisplayMemberBinding="{Binding Path=Description}" />
                        <GridViewColumn Header="Modified" Width="200" DisplayMemberBinding="{Binding Path=ModDate}" />
                        <GridViewColumn Header="Size" Width="150" DisplayMemberBinding="{Binding Path=Size}" />
                    </GridView>
                </ListView.View>
            </ListView>
        </Grid>
    </Grid>
</Window>
