<UserControl
    x:Class="Splitter_UI.Views.ProgressView"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vm="clr-namespace:Splitter_UI.ViewModels"
    x:DataType="vm:ProgressViewModel">

    <Grid RowDefinitions="*,Auto" Background="#111">

        <!-- Processes list -->
        <ItemsControl Grid.Row="0" ItemsSource="{Binding Processes}">
            <ItemsControl.ItemTemplate>
                <DataTemplate x:DataType="vm:ProgressInfo">
                    <Grid ColumnDefinitions="2*,3*,Auto,Auto"
                          Margin="0,2">

                        <TextBlock Grid.Column="0"
                                   Text="{Binding Name}"
                                   VerticalAlignment="Center"
                                   FontSize="12"/>

                        <ProgressBar Grid.Column="1"
                                     Height="12"
                                     Minimum="0"
                                     Maximum="1"
                                     Value="{Binding Progress}"
                                     Margin="8,0"/>

                        <TextBlock Grid.Column="2"
                                   Width="70"
                                   Text="{Binding Eta, StringFormat={}{0:hh\\:mm\\:ss}}"
                                   VerticalAlignment="Center"
                                   Margin="12,0"
                                   FontSize="12"/>

                        <TextBlock Grid.Column="3"
                                   Width="70"
                                   Text="{Binding Speed, StringFormat={}{0:0.00}}"
                                   VerticalAlignment="Center"
                                   Margin="12,0"
                                   FontSize="12"/>

                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

        <!-- Bottom-right Cancel button -->
        <StackPanel Grid.Row="1"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right"
                    Margin="0,12,0,0">

            <Button Content="Cancel"
                    Background="#700000"
                    Foreground="White"
                    Padding="12,6"
                    Margin="0,0,10,10"
                    Command="{Binding CancelCommand}"/>
        </StackPanel>

    </Grid>
</UserControl>
