<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="CustomDialogs.ShowRemindersControl" x:Name="root_element" 
             Loaded="root_Loaded" Width="450" Height="300" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" 
             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">
    <Grid x:Name="LayoutRoot" Margin="5">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition MinHeight="24" Height="Auto" />
                <RowDefinition MinHeight="48" Height="Auto" />
                <RowDefinition />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <StackPanel x:Name="subject" Orientation="Horizontal" Grid.Row="0" Visibility="Collapsed">
                <Image Height="16" Stretch="Uniform">
                    <Image.Source>
                        <BitmapImage UriSource="/C1.WPF.Schedule.4;component/Resources/appointment.png" />
                    </Image.Source>
                </Image>
                <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" FontWeight="Bold" Text="{Binding ElementName=remList,                              Path=SelectedItem.ParentAppointment.Subject, Mode=OneWay}" />
            </StackPanel>
            <StackPanel x:Name="info" Grid.Row="1" Margin="16, 5, 5, 5" Visibility="Collapsed">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="10,2,0,2" VerticalAlignment="Center">
                        <TextBlock.Text>
							<c1:SchedulerLoc Key="ShowReminders:lblStart" DefaultValue="Start time:" />
						</TextBlock.Text>
                    </TextBlock>
                    <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding ElementName=remList, Path=SelectedItem.ParentAppointment.Start}" />
                </StackPanel>
                <StackPanel Name="locationPanel" Orientation="Horizontal" Margin="0, 5, 0, 0">
                    <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{c1:SchedulerLoc Key=ShowReminders:lblLocation, DefaultValue=Location:}" />
                    <TextBlock Margin="10,2,0,2" VerticalAlignment="Center" Text="{Binding ElementName=remList, Path=SelectedItem.ParentAppointment.Location}" />
                </StackPanel>
            </StackPanel>
            <StackPanel x:Name="selectedReminders" Grid.Row="1" Margin="16, 5, 5, 5">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="10,2,0,2" VerticalAlignment="Center">
						<TextBlock.Text>
							<c1:SchedulerLoc Key="ShowReminders:SelectedRemindersNumber" DefaultValue="Selected reminders -" />
						</TextBlock.Text>
                    </TextBlock>
                    <TextBlock VerticalAlignment="Center" Margin="3,2,0,2" Text="{Binding ElementName=remList, Path=SelectedItems.Count}" />
                </StackPanel>
            </StackPanel>
            <ListView x:Name="remList" Grid.Row="2" TabIndex="0" ItemsSource="{Binding Scheduler.ActiveReminders, ElementName=root_element}" IsTabStop="False" MinHeight="70" FocusVisualStyle="{x:Null}" Tag="{Binding Scheduler, ElementName=root_element}">
                <ListView.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="{c1:SchedulerLoc Key=ShowReminders:openMenuItem, DefaultValue=_Open}" CommandTarget="{Binding Parent.PlacementTarget.Tag, RelativeSource={RelativeSource Self}, Mode=OneWay}" CommandParameter="{Binding Parent.PlacementTarget.SelectedItems, RelativeSource={RelativeSource Self}}" Command="c1:C1Scheduler.EditAppointmentDialogCommand" />
                    </ContextMenu>
                </ListView.ContextMenu>
                <ListView.View>
                    <GridView>
                        <GridView.Columns>
                            <GridViewColumn Header="{c1:SchedulerLoc Key=ShowReminders:colSubject, DefaultValue=Subject}" DisplayMemberBinding="{Binding ParentAppointment.Subject}" Width="240" />
                            <GridViewColumn Width="180">
                                <GridViewColumn.Header>
                                    <c1:SchedulerLoc Key="ShowReminders:colTime" DefaultValue="Due in" />
                                </GridViewColumn.Header>
                                <GridViewColumn.DisplayMemberBinding>
                                    <MultiBinding Converter="{x:Static c1:ReminderDueInMultiConverter.Default}">
                                        <Binding Path="ParentAppointment.Start" />
                                        <Binding Path="Now" Source="{x:Static c1:C1Scheduler.ActiveDateTime}" />
                                    </MultiBinding>
                                </GridViewColumn.DisplayMemberBinding>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
                <ListView.ItemContainerStyle>
                    <Style TargetType="{x:Type ListViewItem}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListViewItem}">
                                    <Border Name="backBorder">
                                        <GridViewRowPresenter Name="rowPresenter" Content="{TemplateBinding Content}" Columns="{TemplateBinding GridView.ColumnCollection}" />
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsSelected" Value="true">
                                            <Setter TargetName="backBorder" Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />
                                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>
            <DockPanel Grid.Row="3" LastChildFill="false" x:Name="buttonsGrid">
                <Button x:Name="dismissAllButton" DockPanel.Dock="Left" TabIndex="1" Margin="0,2,0,2" Command="c1:C1Scheduler.DismissCommand" CommandTarget="{Binding Scheduler, ElementName=root_element}" VerticalAlignment="Center" Padding="2" MinWidth="70">
                    <Button.Content>
                        <c1:SchedulerLoc Key="ShowReminders:btnDismissAll_Text" DefaultValue="Dismiss _All" />
                    </Button.Content>
                </Button>
                <Button x:Name="dismissButton" DockPanel.Dock="Right" TabIndex="3" Margin="10,2,0,2" VerticalAlignment="Center" CommandParameter="{Binding ElementName=remList, Path=SelectedItems}" Padding="2" MinWidth="70" CommandTarget="{Binding Scheduler, ElementName=root_element}" Command="c1:C1Scheduler.DismissCommand" Content="{c1:SchedulerLoc Key=ShowReminders:btnDismiss_Text, DefaultValue=_Dismiss}" />
                <Button x:Name="openButton" DockPanel.Dock="Right" TabIndex="2" Margin="10,2,0,2" VerticalAlignment="Center" CommandParameter="{Binding ElementName=remList, Path=SelectedItems}" CommandTarget="{Binding Scheduler, ElementName=root_element}" Command="c1:C1Scheduler.EditAppointmentDialogCommand" Padding="2" MinWidth="70">
                    <Button.Content>
                        <c1:SchedulerLoc Key="ShowReminders:btnOpen_Text" DefaultValue="_Open Item" />
                    </Button.Content>
                </Button>
            </DockPanel>
            <TextBlock Grid.Row="4" VerticalAlignment="Center" Margin="0,2,0,2">
 				<TextBlock.Text>
					<c1:SchedulerLoc Key="ShowReminders:lblSnooze" DefaultValue="Click Snooze to be reminded again in:" />
				</TextBlock.Text>
            </TextBlock>
            <Grid x:Name="snoozeGrid" Grid.Row="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <c1:C1TimeEditor x:Name="snoozeTimeSpansCombo" TabIndex="4" CycleChangesOnBoundaries="False" Margin="0,2,0,2" Padding="1" VerticalAlignment="Center" Format="TimeSpan" Increment="00:10" Minimum="0:01" />             
                <Button x:Name="snoozeButton" Grid.Column="1" TabIndex="5" Click="snoozeButton_Click" Margin="10,2,0,2" VerticalAlignment="Center" IsDefault="True" Padding="2" MinWidth="70" Content="{c1:SchedulerLoc Key=ShowReminders:btnSnooze_Text, DefaultValue=_Snooze}" />
            </Grid>
        </Grid>
    </Grid>
</UserControl>