<UserControl x:Class="DBInStudio.Desktop.View.DatabaseSettingView"
             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:local="clr-namespace:DBInStudio.Desktop"
             xmlns:viewmodel="clr-namespace:DBInStudio.Desktop.ViewModel"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        
        <Style x:Key="ListBoxItemContainerStyle1" TargetType="{x:Type ListBoxItem}">
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="Padding" Value="4,1"/>
            <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                        <Border x:Name="Bd" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        </Border>
                        
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <DataTemplate DataType="{x:Type viewmodel:DriverSetViewModel}">
            <Grid HorizontalAlignment="Stretch" Background="Transparent" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Border BorderThickness="0,0,0,0.5" BorderBrush="LightGray" SnapsToDevicePixels="True" UseLayoutRounding="True">
                    <TextBlock  Margin="10,0,2,5" Text="{Binding Name}" HorizontalAlignment="Stretch" VerticalAlignment="Center"  Foreground="{DynamicResource Window.Forground}"/>
                </Border>
                
                <ListBox Grid.Row="1" BorderThickness="0" Background="{x:Null}" ItemsSource="{Binding Children}" ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle1}">
                    
                </ListBox>
            </Grid>
        </DataTemplate>

        <DataTemplate DataType="{x:Type viewmodel:DriverSettingItem}">
            <Grid Height="32">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding Name}"  VerticalAlignment="Center" Foreground="{DynamicResource Window.Forground}"/>
                <TextBox CaretBrush="{DynamicResource Window.Forground}" VerticalContentAlignment="Center" Background="#1FFFFFFF" Foreground="{DynamicResource Window.Forground}" Height="24"  VerticalAlignment="Center" Text="{Binding Value,Mode=TwoWay}" Grid.Column="1" Width="160" />
            </Grid>
        </DataTemplate>
        
        
    </UserControl.Resources>
    <Grid Background="#7F000000" SnapsToDevicePixels="True" UseLayoutRounding="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="80"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="32"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Text="{local:ResMarker ServerPort,:}" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center"/>
        <TextBox CaretBrush="{DynamicResource Window.Forground}" Background="#1FFFFFFF" Foreground="{DynamicResource Window.Forground}" Height="24" VerticalContentAlignment="Center" Grid.Column="1" HorizontalAlignment="Left" Margin="10,0,0,0" Text="{Binding ServerPort,Mode=TwoWay,UpdateSourceTrigger=LostFocus}" TextWrapping="Wrap" VerticalAlignment="Center" Width="120"/>
        <ListBox HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,10" ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle1}" Background="{x:Null}" BorderThickness="0" Grid.Row="1" Grid.ColumnSpan="2"  ItemsSource="{Binding Children}">
            
        </ListBox>

    </Grid>
</UserControl>
