<Window x:Class="StructureHelper.Windows.Forces.ForceFilePropertyView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:StructureHelper.Windows.Forces"
        d:DataContext="{d:DesignInstance local:ForceFilePropertyVM}"
        mc:Ignorable="d"
        Title="File import properties" Height="250" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <DataTemplate x:Key="ColumnProperty">
            <Expander Header="{Binding Name}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"/>
                        <RowDefinition Height="25"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" Text="Column index"/>
                    <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Index, ValidatesOnDataErrors=True}"/>
                    <TextBlock Grid.Row="1" Text="Column factor"/>
                    <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Factor, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
                </Grid>
            </Expander>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="35"/>
        </Grid.RowDefinitions>
        <TabControl>
            <TabItem Header="Main">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25"/>
                        <RowDefinition Height="25"/>
                        <RowDefinition Height="25"/>
                        <RowDefinition Height="25"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <TextBlock Text="File name"/>
                    <Grid Grid.Column="1">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="20"/>
                        </Grid.ColumnDefinitions>
                        <TextBox Text="{Binding FilePath}"/>
                        <Button Grid.Column="1" Content="..." Command="{Binding OpenFileCommand}"/>
                    </Grid>
                    <TextBlock Grid.Row="1" Text="Skip row(s) before header"/>
                    <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding SkipRowBeforeHeaderCount, ValidatesOnDataErrors=True}"/>
                    <TextBlock Grid.Row="2" Text="Skip row(s) of header"/>
                    <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding SkipRowHeaderCount, ValidatesOnDataErrors=True}"/>
                    <TextBlock Grid.Row="3" Text="Global factor value"/>
                    <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding GlobalFactor, Converter={StaticResource PlainDouble}, ValidatesOnDataErrors=True}"/>
                </Grid>
            </TabItem>
            <TabItem Header="Columns">
                <ListBox ItemsSource="{Binding ColumnProperties}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <ContentControl Width="350" ContentTemplate="{StaticResource ColumnProperty}" Content="{Binding}"/>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </TabItem>
        </TabControl>
        <ContentControl Grid.Row="1" ContentTemplate="{StaticResource OkCancelButtons}" Content="{Binding}"/>
    </Grid>
</Window>
