<UserControl x:Class="Deployer.Lumia.Gui.Views.Parts.ProgressControl"
             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:mah="http://metro.mahapps.com/winfx/xaml/controls"
             mc:Ignorable="d" 
             d:DesignHeight="35" d:DesignWidth="153.75" DataContext="{Binding Source={StaticResource Locator}, Path=OngoingOperationViewModel}">
    <Grid>
        <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1" Visibility="{Binding IsProgressIndeterminate, Converter={StaticResource CollapseOnTrue}}">
            <Grid >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <mah:MetroProgressBar Minimum="0"
                                      Width="300"
                                      Height="25"
                                      Maximum="1"
                                      Margin="0"
                                      IsIndeterminate="{Binding IsProgressIndeterminate}"
                                      Value="{Binding Progress, Mode=OneWay}"
                                      VerticalAlignment="Stretch">
                    <mah:MetroProgressBar.ToolTip>
                        <TextBlock Text="{Binding Path=Progress, StringFormat='P0'}" />
                    </mah:MetroProgressBar.ToolTip>
                </mah:MetroProgressBar>
            </Grid>
        </Border>

        <StackPanel Visibility="{Binding IsProgressIndeterminate, Converter={StaticResource CollapseOnFalse}}">

            <TextBlock FontWeight="Bold" Text="{Binding Downloaded, StringFormat='{}{0} downloaded'}"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center" />

        </StackPanel>
    </Grid>
</UserControl>
