<Window x:Class="Valg.EVA.Skanning.Scan.Startup.SelectScannerModel.ScannerModelSelectorWindow"
             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:selectScannerModel="clr-namespace:Valg.EVA.Skanning.Scan.Startup.SelectScannerModel"
             mc:Ignorable="d"
                Icon="/Valg.EVA.Skanning.Assets;component/Images/Icons/EvaScan.ico"
            WindowStartupLocation="CenterScreen"
            ShowInTaskbar="True"
            Style="{DynamicResource PopUpWindowAction}"
            d:DataContext="{d:DesignInstance d:Type=selectScannerModel:ScannerModelSelectorWindowViewModelNyt}"
            MinWidth="530"
            MinHeight="252"
>
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Valg.EVA.Skanning.Assets;component/ResourceDictionaries/ResourceLibrary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid Margin="20">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Border Grid.Row="0" Background="{StaticResource ActiveElementBorderBrush}">
            <StackPanel Margin="20" Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <TextBlock VerticalAlignment="Center"
                               Foreground="White"
                               Text="{Binding SelectScanModelTitleText}" 
                               Style="{StaticResource TextBlockLarge}" />

                    <ComboBox Margin="20,0,0,0" TabIndex="0" Style="{StaticResource ComboBoxNormal}" MinWidth="250"
                      x:Name="modelNameComboBox" ItemsSource="{Binding GetScannerListItems}"  
                      SelectedItem="{Binding CurrentScannerListItem, Mode=TwoWay}" 
                      IsTextSearchEnabled="True">
                        <ComboBox.Resources>
                            <DataTemplate DataType="{x:Type selectScannerModel:SeparatorItem}">
                                <Separator Focusable="False" IsEnabled="False" />
                            </DataTemplate>
                            <DataTemplate DataType="{x:Type selectScannerModel:ScannerModelItem}">
                                <Grid Margin="0,2">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="25" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="1" Text="{Binding Path=ModelName}" Style="{StaticResource ListBoxItemStyle}" />
                                    <Image Grid.Column="0" 
                                           Visibility="{Binding Path=IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}" 
                                           Source="/Valg.EVA.Skanning.Assets;component/Images/Icons/usb-connected-128.ico">
                                    </Image>
                                </Grid>
                            </DataTemplate>
                            <DataTemplate DataType="{x:Type selectScannerModel:OthersItem}">
                                <TextBlock Text="{Binding Text}" />                             
                            </DataTemplate>
                        </ComboBox.Resources>
                    </ComboBox>
                    <Button Margin="5,0,0,0" 
                            Content="{Binding SelectOtherScannerText, FallbackValue='Annet...'}"
                            Style="{StaticResource BlueButton}"
                            Command="{Binding SelectUnsupportedScannerCommand}" />
                </StackPanel>

                <CheckBox Margin="0,20,0,20" Foreground="White" TabIndex="1" IsChecked="{Binding DontShowSelectScannerModel, Mode=TwoWay}" 
                  Content="{Binding SelectScanModelDontShowThisMessageAgainText, FallbackValue='Ikke vis denne meldingen igjen'}" 
                  VerticalAlignment="Center" Style="{StaticResource CheckBoxNormal}" />
            </StackPanel>
        </Border>

        <StackPanel Margin="0,20,0,0" Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Margin="0,0,5,0" Width="125" TabIndex="2" Height="49" IsDefault="True" 
                VerticalAlignment="Center" IsEnabled="{Binding OkBtnEnabled}" 
                Style="{StaticResource BlueButtonOk}" Click="OnButtonOkClick" 
                Command="{Binding SetScannerModelCommand}" CommandParameter="{Binding ElementName=modelNameComboBox,Path=SelectedItem}" 
                Content="{Binding SelectScanModelOkButtonText, FallbackValue='OK'}"  />

            <Button Margin="5,0,0,0" Width="125" TabIndex="3" Height="49" IsCancel="True"  
                VerticalAlignment="Center" Style="{StaticResource RedButtonCancel}" Click="OnButtonCancelClick" 
                Content="{Binding SelectScanModelExitButtonText, FallbackValue='Avslutt'}"   />
        </StackPanel>
    </Grid>

</Window>

