<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="CustomDialogs.SelectFromListScene" IsTabStop="False" Loaded="UserControl_Loaded" Height="380" Width="400" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">
    <UserControl.Resources>

        <c1:IsNotEmptyOrSpaceStringConverter x:Key="IsNotEmptyOrSpaceStringConverter" />
        <SolidColorBrush x:Key="BorderBrush" Color="#3F000000" />

        <c1:C1_Schedule_SelectFromListScene x:Key="C1_Schedule_SelectFromListScene" />
    </UserControl.Resources>
    <Border Padding="5">
        <Grid Margin="5,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="3*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock Text="{Binding selected, Source={StaticResource C1_Schedule_SelectFromListScene}}" Margin="0,2,0,2" VerticalAlignment="Center" />
            <TextBox Grid.Row="1" IsReadOnly="True" IsTabStop="False" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" Padding="2" x:Name="selectedValues" />
            <TextBlock Grid.Row="2" Text="{Binding available, Source={StaticResource C1_Schedule_SelectFromListScene}}" VerticalAlignment="Center" Padding="2" Margin="0,5,0,2" />
            <Grid Grid.Row="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBox x:Name="newItemText" TabIndex="5" HorizontalAlignment="Stretch" Margin="0,2,0,2" VerticalAlignment="Center" Padding="2" />
                <ScrollViewer Grid.Row="1" VerticalAlignment="Stretch" Grid.RowSpan="2" Padding="0" Margin="0,2,0,2">
                <!-- Scroll Viewer fixes issue with flickering check sign at scrolling: http://forums.silverlight.net/forums/t/114156.aspx-->
                <ListBox TabIndex="0" x:Name="sourceListBox" IsTabStop="False">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Content="{Binding}" x:Name="chk" Foreground="{Binding Foreground, ElementName=newItemText}" GotFocus="SourceItemSelectedCB_GotFocus" Loaded="SourceItemSelectedCB_Loaded" Checked="SourceItemSelectedCB_Checked" Unchecked="SourceItemSelectedCB_Unchecked" />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="IsTabStop" Value="False" />
                            <Setter Property="Padding" Value="2,1,1,1" />
                        </Style>
                    </ListBox.ItemContainerStyle>
                </ListBox>
                </ScrollViewer>
                <Button x:Name="addButton" TabIndex="6" Click="addButton_Click" Grid.Row="0" Grid.Column="1" Padding="5" MinWidth="70" Margin="10,2,0,2" VerticalAlignment="Top" Content="{Binding btnAdd_Text, Source={StaticResource C1_Schedule_SelectFromListScene}}" IsEnabled="{Binding Text, ElementName=newItemText,       Converter={StaticResource IsNotEmptyOrSpaceStringConverter}}" />
                <Button Name="deleteButton" TabIndex="1" VerticalAlignment="Top" Content="{Binding btnRemove_Text, Source={StaticResource C1_Schedule_SelectFromListScene}}" Padding="5" MinWidth="70" Margin="10,2,0,2" Click="deleteButton_Click" Grid.Row="1" Grid.Column="1" />
                <Button Name="resetButton" TabIndex="2" VerticalAlignment="Top" Content="{Binding btnReset_Text, Source={StaticResource C1_Schedule_SelectFromListScene}}" Padding="5" MinWidth="70" Margin="10,2,0,2" Click="resetButton_Click" Grid.Row="2" Grid.Column="1" />
            </Grid>
			<Border Margin="-10,10,-10,-5" Grid.Row="4" Padding="0,0,10,5" BorderBrush="{StaticResource BorderBrush}" BorderThickness="0,1,0,0" Height="41">
	            <Border.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <LinearGradientBrush.GradientStops>
                            <GradientStop Color="#26000000" Offset="1" />
                        </LinearGradientBrush.GradientStops>
                    </LinearGradientBrush>
                </Border.Background>
	            <c1:C1DockPanel LastChildFill="false" HorizontalAlignment="Right" Margin="0,5,0,0">
	                <Button Name="okButton" Click="okButton_Click" TabIndex="3" Padding="5" MinWidth="70" Margin="10,2,0,2" c1:C1DockPanel.Dock="Left" Content="{Binding btnOk_Text, Source={StaticResource C1_Schedule_SelectFromListScene}}" />
	                <Button Name="cancelButton" Click="cancelButton_Click" TabIndex="4" c1:C1DockPanel.Dock="Left" Padding="5" MinWidth="70" Margin="10,2,0,2" Content="{Binding btnCancel_Text, Source={StaticResource C1_Schedule_SelectFromListScene}}" />
	            </c1:C1DockPanel>
			</Border>	
        </Grid>
    </Border>
</UserControl>