<Window x:Class="Valg.EVA.Skanning.Scan.Startup.SelectScannerModel.UnsupportedScannerModelSelectorWindow"
        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"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        mc:Ignorable="d"
        Icon="/Valg.EVA.Skanning.Assets;component/Images/Icons/EvaScan.ico"
        WindowStartupLocation="CenterScreen"
        ShowInTaskbar="False"
        Style="{DynamicResource PopUpWindowAction}"
        d:DataContext="{d:DesignInstance d:Type=selectScannerModel:UnsupportedScannerModelSelectorWindowViewModel}"
        MinWidth="530"
        MinHeight="600" Height="685.821"
        >
    <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">
                <TextBlock VerticalAlignment="Center"
                               Foreground="White"
                               Text="{Binding TitleText}" 
                               Style="{StaticResource TextBlockLarge}" />
                <ListBox TabIndex="0" MinWidth="250"
                      x:Name="modelNameListBox" ItemsSource="{Binding ScannerModelList}"  
                         SelectedItem="{Binding CurrentSelection, Mode=TwoWay}" 
                         IsTextSearchEnabled="True" 
                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                         Margin="10,0" Width="Auto" Height="502">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="0,2">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="25" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="1" Text="{Binding Path=Name}" 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>
                    </ListBox.ItemTemplate>
                    <i:Interaction.Behaviors>
                        <selectScannerModel:ScrollIntoViewForListBox />
                    </i:Interaction.Behaviors>
                </ListBox>

            </StackPanel>
        </Border>

        <DockPanel Margin="0,20,0,0" Grid.Row="1" >

            <Button Margin="5,0,0,0" Width="125" TabIndex="3" Height="49" IsCancel="True"  
                    VerticalAlignment="Center" 
                    IsEnabled="{Binding ConfigButtonEnabled}" 
                    ToolTip="{Binding Path=ConfigButtonTooltipText}" ToolTipService.ShowOnDisabled="true"
                    DockPanel.Dock="Left" 
                    Style="{StaticResource BlueButtonSettings}" 
                    Command="{Binding ConfigureScanncerCommand}" CommandParameter="{Binding ElementName=modelNameListBox,Path=SelectedItem}" 
                    Content="{Binding ConfigButtonText, FallbackValue='Tilpass'}"   />

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

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

</Window>

