<UserControl x:Class="TwoCamWPF.MainForm.LeftPanelPreview"
             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" 
             mc:Ignorable="d" 
         
             d:DesignHeight="300" d:DesignWidth="300"
             >
    <UserControl.Resources>
        <Style x:Key="NoChromeButton" TargetType="{x:Type Button}">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Padding" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid x:Name="Chrome" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="#ADADAD"/>
                                <Setter Property="Opacity" TargetName="Chrome" Value="0.5"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Border Grid.Row="0"  BorderBrush="Silver" BorderThickness="2">
        <ScrollViewer Name="scrollViewer1" Grid.Column="0" BorderBrush="Silver" BorderThickness="5">
            <ListBox ItemsSource="{Binding}" Name="Layout">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Button Width="{Binding ElementName=Layout, Path=ActualWidth}"
                                 Style="{DynamicResource NoChromeButton}" Command="{Binding}" CommandParameter="{Binding}" >
                            <StackPanel Orientation="Vertical">
                            <TextBlock Text="{Binding Name}"
                                        Width="{Binding ElementName=Layout, Path=ActualWidth}"
                                   
                                       />
                                <!--<Image Source="Desert.png" Stretch="None"/>-->
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="20"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <ProgressBar Grid.Column="0" Orientation="Vertical" 
                                             Maximum="{Binding MaxBuffer}" 
                                             Value="{Binding CurrentBuffer}" 
                                             Minimum="0" 
                                             Margin="5"/>

                                <Image Source="{Binding Image}"
                                               Grid.Column="1"
                                    Width="{Binding ElementName=Layout, Path=ActualWidth}"
                                    Stretch="Uniform"
                                    Height="{Binding ElementName=Layout, Path=ActualWidth}"
                                    MaxHeight="100">
                                </Image>

                                </Grid>
                            </StackPanel>
                        </Button>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </ScrollViewer>
    </Border>

</UserControl>
