<UserControl x:Class="Translumo.Controls.ProxyEditList"
             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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:controls="clr-namespace:Translumo.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="450">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>

        <StackPanel Orientation="Horizontal"  Grid.Row="0" Margin="0,-6,0,20">
            <Button Content="{materialDesign:PackIcon KeyboardBackspace}" Style="{StaticResource FlatLeftButton}" Click="btnCancel_Click"/>
            <Label Content="{DynamicResource Str.ProxySettings.Caption}" Name="LCaption" Style="{StaticResource PanelCaptionLabel}"></Label>
        </StackPanel>

        <DockPanel Grid.Row="1" Name="DpScroll" LastChildFill="False" SizeChanged="DpScroll_SizeChanged">
            <ScrollViewer Name="ScProxyContent" DockPanel.Dock="Top" Style="{DynamicResource MaterialDesignScrollViewer}" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto">
                <ItemsControl Name="IcProxyList" ItemsSource="{Binding}">
                    <ItemsControl.ItemContainerStyle>
                        <Style>
                            <Setter Property="FrameworkElement.Margin" Value="0 0 0 5"/>
                        </Style>
                    </ItemsControl.ItemContainerStyle>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <controls:ProxySettingCard Login="{Binding Login, Mode=TwoWay}" Password="{Binding Password, Mode=TwoWay}" 
                                                       IpAddress="{Binding IpAddress, Mode=TwoWay}" Port="{Binding Port, Mode=TwoWay}" DeleteCommand="{Binding DeleteCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>
            <Button Name="BtnAddNew" DockPanel.Dock="Top"  Margin="5,5,5,0" Style="{DynamicResource MaterialDesignFlatDarkButton}" Content="{materialDesign:PackIcon Plus}" Command="{Binding AddCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"></Button>
        </DockPanel>

        <Button Name="BtnApply" Grid.Row="2" Content="{DynamicResource Str.Button.Apply}" Style="{StaticResource OutlinedBottomButton}" Click="btnApply_Click"></Button>
    </Grid>
</UserControl>
