<Window x:Class="Valg.EVA.Skanning.UserInterfaceElements.UserSettingWindow.UserSettingWindow"
        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:userSettingWindow="clr-namespace:Valg.EVA.Skanning.UserInterfaceElements.UserSettingWindow"
        xmlns:userInterfaceElements="clr-namespace:Valg.EVA.Skanning.UserInterfaceElements"
        xmlns:language="clr-namespace:Valg.EVA.Skanning.Resources.Language;assembly=Valg.EVA.Skanning.Resources"
        WindowStartupLocation="CenterOwner"
        ShowInTaskbar="False"
        Style="{DynamicResource PopUpWindowAction}"
        Title="{x:Static language:LanguageString.Label_Language}"
        mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance d:Type=userSettingWindow:UserSettingWindowViewModel}"
        Icon="/Valg.EVA.Skanning.Assets;component/Images/Icons/EvaScan.ico"
        MinWidth="400">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Valg.EVA.Skanning.Assets;component/ResourceDictionaries/ResourceLibrary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="70"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0" Background="{StaticResource ActiveElementBorderBrush}">
            <StackPanel Margin="15" Grid.Row="0">
                <TextBlock HorizontalAlignment="Center" Text="{Binding UserSettingsText, FallbackValue='Settings'}" Foreground="White" Style="{StaticResource TextBlockMediumHeader}" Margin="0,20,0,20" />
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Column="0" Content="{x:Static language:LanguageString.Label_Language}" Style="{StaticResource LabelNormal}" Foreground="White" VerticalAlignment="Center" />
                    <ComboBox Grid.Column="1" VerticalAlignment="Top" Style="{StaticResource ComboBoxNormal}" SelectedValue="{Binding UserSettings.Language}" SelectedValuePath="Tag">
                        <ComboBoxItem Content="{x:Static language:LanguageString.Label_NorwegianBokmal}" Tag="nb-NO" />
                        <ComboBoxItem Content="{x:Static language:LanguageString.Label_NorwegianNynorsk}" Tag="nn-NO" />
                        <ComboBoxItem Content="{x:Static language:LanguageString.Label_English}" Tag="en-GB" />
                    </ComboBox>
                </Grid>

                <ItemsControl ItemsSource="{Binding AdditionalSettings}" IsTabStop="False">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate DataType="userInterfaceElements:AdditionalSettingCommand">
                            <Button Style="{StaticResource LinkButtonMedium}" Foreground="White" Click="AdditionalSettingCommandClicked" Command="{Binding Path=Command}" Content="{Binding ButtonText}"/>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Margin="5,0,0,0"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
                
                <Button Margin="5,25,0,5" Style="{StaticResource LinkButtonMedium}" Foreground="White" Command="{Binding Path=ResetCommand}" Content="{Binding ResetText, FallbackValue='Reset settings'}" Click="OnButtonResetClick"/>
            </StackPanel>
        </Border>

        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Height="49" Margin="0,0,10,0" 
                    Style="{StaticResource BlueButtonOk}" Click="OnButtonOkClick" 
                    Command="{Binding Path=SaveCommand}" Content="{Binding OkText, FallbackValue='OK'}" />
            <Button Height="49" Style="{StaticResource RedButtonCancel}" 
                    IsCancel="True" Content="{Binding CancelText, FallbackValue='Cancel'}" />
        </StackPanel>
    </Grid>
</Window>
