<?xml version="1.0" encoding="utf-8"?>
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:vm="using:ABStemPlayer.ViewModels"
             x:DataType="vm:WaveformBandViewModel"
             x:Class="ABStemPlayer.Views.WaveformBandView">

    <Border Background="#181818"
            CornerRadius="2"
            Padding="4">

        <Grid RowDefinitions="Auto,*">

            <!-- Header -->
            <StackPanel Orientation="Horizontal"
                        Margin="0,0,0,4"
                        Spacing="8">
                <TextBlock Text="{Binding BandName}"
                           Foreground="#f0f0f0" />
                <TextBlock Text="{Binding DurationFormatted}"
                           Foreground="#c0c0c0" />
            </StackPanel>

            <!-- Waveform -->
            <Canvas x:Name="WaveformCanvas"
                    Grid.Row="1"
                    Background="#101010"
                    Height="80"
                    SizeChanged="WaveformCanvas_OnSizeChanged">

                <!-- Waveform geometry -->
                <Path Stroke="#40a0ff"
                      StrokeThickness="1"
                      Data="{Binding WaveformGeometry}" />

                <!-- Playback cursor -->
                <Rectangle Fill="#ff0000"
                           Width="2"
                           Height="{Binding CanvasHeight}"
                           Canvas.Left="{Binding PlaybackX}" />

            </Canvas>
        </Grid>
    </Border>
</UserControl>
