<featurebase:FeaturePage
    x:Class="was.touchcopy.features.reminders.RemindersPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:featurebase="using:was.touchcopy.features"
    xmlns:converters="using:was.touchcopy.features.reminders.converters"
    xmlns:commonconverters="using:was.touchcopy.features.converters"
    xmlns:local="using:was.touchcopy.features.reminders"
    xmlns:utilities="using:was.touchcopy.features.utilities"
    xmlns:commonfeatures="using:was.touchcopy.features"
    xmlns:commoncontrols="using:was.touchcopy.features.controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=local:RemindersPage}"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Page.Resources>
        <ResourceDictionary>
            <CollectionViewSource x:Key="RemindersCVS" IsSourceGrouped="True" />
            <converters:ColorStringToColorConverter x:Key="ColorStringToColorConverter" />
            <commonconverters:ValueToOpacityConverter x:Key="ValueToOpacityConverter" />
            <commonconverters:ValueToVisibilityConverter x:Key="ValueToVisibilityConverter" />
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <Grid x:Name="gridMain">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Border Style="{ThemeResource PageHeaderBorderStyle}">
                <Grid>
                    <CommandBar Style="{ThemeResource PageHeaderCommandBarStyle}">
                        <featurebase:CopyProgressAppBarUserController x:Name="copyProgressUserControl" Visibility="Collapsed" OnCancelTapped="_copyProgressUserControl_OnCancelTapped" MaxWidth="350"/>
                        <AppBarButton x:Name="appBarButtonSavePDF" x:Uid="AppBarButtonSavePDF" Label="XX Save as PDF" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonSavePDF_Click" IsEnabled="{x:Bind IsExportAvailable, Mode=OneWay}">
                            <AppBarButton.Content>
                                <FontIcon Glyph="&#xEA90;" Foreground="{x:Bind utilities:AppBarUtilities.BrushForAppBarIcon(appBarButtonSavePDF.IsEnabled), Mode=OneWay}"/>
                            </AppBarButton.Content>
                        </AppBarButton>
                        <AppBarButton x:Name="appBarButtonSaveHTML" x:Uid="AppBarButtonSaveHTML" Label="XX Save as HTML" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonSaveHTML_Click" IsEnabled="{x:Bind IsExportAvailable, Mode=OneWay}">
                            <AppBarButton.Content>
                                <FontIcon Glyph="&#xE78C;" Foreground="{x:Bind utilities:AppBarUtilities.BrushForAppBarIcon(appBarButtonSaveHTML.IsEnabled), Mode=OneWay}"/>
                            </AppBarButton.Content>
                        </AppBarButton>
                        <AppBarButton x:Name="appBarButtonSaveTXT" x:Uid="AppBarButtonSaveTXT" Label="XX Save as Text" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonSaveTXT_Click" IsEnabled="{x:Bind IsExportAvailable, Mode=OneWay}">
                            <AppBarButton.Content>
                                <FontIcon Glyph="&#xF000;" Foreground="{x:Bind utilities:AppBarUtilities.BrushForAppBarIcon(appBarButtonSaveTXT.IsEnabled), Mode=OneWay}"/>
                            </AppBarButton.Content>
                        </AppBarButton>
                        <AppBarButton x:Name="appBarButtonPrint" x:Uid="AppBarButtonPrint" Label="XX Print" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonPrint_Click" IsEnabled="{x:Bind IsPrintAvailable, Mode=OneWay}">
                            <AppBarButton.Content>
                                <FontIcon Glyph="&#xE749;" Foreground="{x:Bind utilities:AppBarUtilities.BrushForAppBarIcon(appBarButtonPrint.IsEnabled), Mode=OneWay}"/>
                            </AppBarButton.Content>
                        </AppBarButton>
                        <AppBarButton x:Name="appBarButtonSaveAttachment" x:Uid="AppBarButtonSaveAttachment" Label="XX Save to PC" Style="{ThemeResource AppBarButtonStyle}" Click="_appBarButtonSaveAttachment_Click" Visibility="Collapsed">
                            <AppBarButton.Content>
                                <FontIcon Glyph="&#xE78C;" Foreground="{x:Bind utilities:AppBarUtilities.BrushForAppBarIcon(appBarButtonSaveAttachment.IsEnabled), Mode=OneWay}"/>
                            </AppBarButton.Content>
                        </AppBarButton>
                    </CommandBar>
                    <TextBlock Text="{Binding PageTitle}" Style="{ThemeResource PageHeaderTitleStyle}"/>
                </Grid>
            </Border>
            <SplitView Grid.Row="1" Style="{ThemeResource FeatureSplitViewStyle}">
                <SplitView.Pane>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TextBox x:Name="textBoxRemindersFilter" x:Uid="RemindersFilterTextBox" Margin="10,5" PlaceholderText="XX Search Reminders" 
                             TextChanged="_textBoxRemindersFilter_TextChanged" />
                        <ListView x:Name="listViewGroups" Grid.Row="1" SelectionMode="Extended" ItemsSource="{x:Bind RemindersGroups.View, Mode=OneWay}" SelectionChanged="_listViewGroups_SelectionChanged">
                            <ListView.Header>
                                <StackPanel Visibility="{Binding Path=Text, ElementName=textBoxRemindersFilter, Converter={StaticResource ValueToVisibilityConverter}, ConverterParameter='invert', Mode=OneWay}">
                                    <Grid ColumnSpacing="8" RowSpacing="8" Margin="12,8,12,8">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="Auto"/>
                                        </Grid.RowDefinitions>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.Resources>
                                            <Style TargetType="Button">
                                                <Setter Property="Background" Value="Transparent" />
                                                <Setter Property="BorderThickness" Value="0" />
                                                <Setter Property="CornerRadius" Value="{ThemeResource ListViewItemCornerRadius}" />
                                                <Setter Property="HorizontalAlignment" Value="Stretch"/>
                                                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                                <Setter Property="Padding" Value="0" />
                                            </Style>
                                        </Grid.Resources>
                                        <Button DataContext="{x:Bind TodayList, Mode=OneWay}" Visibility="{x:Bind TodayList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                            <Grid>
                                                <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                <Grid Margin="8,4" ColumnSpacing="4" RowSpacing="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <FontIcon Glyph="&#xe8d1;" />
                                                    <TextBlock Grid.Column="1" Text="{Binding ItemCount}" Style="{ThemeResource TitleTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" FontSize="24" />
                                                    <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                </Grid>
                                            </Grid>
                                        </Button>
                                        <Button Grid.Column="1" DataContext="{x:Bind ScheduledList, Mode=OneWay}" Visibility="{x:Bind ScheduledList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                            <Grid>
                                                <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                <Grid Margin="8,4" ColumnSpacing="4" RowSpacing="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <FontIcon Glyph="&#xe787;" />
                                                    <TextBlock Grid.Column="1" Text="{Binding ItemCount}" Style="{ThemeResource TitleTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" FontSize="24" />
                                                    <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                </Grid>
                                            </Grid>
                                        </Button>
                                        <Button Grid.Row="1" DataContext="{x:Bind AllList, Mode=OneWay}" Visibility="{x:Bind AllList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                            <Grid>
                                                <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                <Grid Margin="8,4" ColumnSpacing="4" RowSpacing="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <FontIcon Glyph="&#xe7b8;" />
                                                    <TextBlock Grid.Column="1" Text="{Binding ItemCount}" Style="{ThemeResource TitleTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" FontSize="24" />
                                                    <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                </Grid>
                                            </Grid>
                                        </Button>
                                        <Button Grid.Row="1" Grid.Column="1" DataContext="{x:Bind FlaggedList, Mode=OneWay}" Visibility="{x:Bind FlaggedList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                            <Grid>
                                                <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                <Grid Margin="8,4" ColumnSpacing="4" RowSpacing="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <FontIcon Glyph="&#xe7c1;" />
                                                    <TextBlock Grid.Column="1" Text="{Binding ItemCount}" Style="{ThemeResource TitleTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" FontSize="24" />
                                                    <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                </Grid>
                                            </Grid>
                                        </Button>
                                        <Button Grid.Row="2" DataContext="{x:Bind UrgentList, Mode=OneWay}" Visibility="{x:Bind UrgentList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                            <Grid>
                                                <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                <Grid Margin="8,4" ColumnSpacing="4" RowSpacing="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <FontIcon Glyph="&#xe8c9;" />
                                                    <TextBlock Grid.Column="1" Text="{Binding ItemCount}" Style="{ThemeResource TitleTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" FontSize="24" />
                                                    <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                </Grid>
                                            </Grid>
                                        </Button>
                                        <Button Grid.Row="2" Grid.Column="1" DataContext="{x:Bind CompletedList, Mode=OneWay}" Visibility="{x:Bind CompletedList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                            <Grid>
                                                <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                <Grid Margin="8,4" ColumnSpacing="4" RowSpacing="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <FontIcon Glyph="&#xe73e;" />
                                                    <TextBlock Grid.Column="1" Style="{ThemeResource TitleTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" FontSize="24" />
                                                    <TextBlock Grid.ColumnSpan="2" Grid.Row="1" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                </Grid>
                                            </Grid>
                                        </Button>
                                        <StackPanel Grid.Row="3" Grid.ColumnSpan="2" Spacing="4">
                                            <Button DataContext="{x:Bind SiriSuggestionsList, Mode=OneWay}" Visibility="{x:Bind SiriSuggestionsList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                                <Grid>
                                                    <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                    <Grid Margin="8,8" ColumnSpacing="4" RowSpacing="2">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="Auto" />
                                                            <ColumnDefinition Width="*" />
                                                            <ColumnDefinition Width="Auto" />
                                                        </Grid.ColumnDefinitions>
                                                        <FontIcon Glyph="&#xE709;" />
                                                        <TextBlock VerticalAlignment="Center" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                        <TextBlock Grid.Column="1" Text="{Binding ItemCount}"  Style="{ThemeResource CaptionTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" />

                                                    </Grid>
                                                </Grid>
                                            </Button>
                                            <Button DataContext="{x:Bind RecentlyDeletedList, Mode=OneWay}" Visibility="{x:Bind RecentlyDeletedList, Converter={StaticResource ValueToVisibilityConverter}, Mode=OneWay}" Click="_autoGeneratedListItem_Click">
                                                <Grid>
                                                    <Border Background="{ThemeResource TextFillColorInverse}" Opacity="0.5" />
                                                    <Grid Margin="8,8" ColumnSpacing="4" RowSpacing="2">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="Auto" />
                                                            <ColumnDefinition Width="*" />
                                                            <ColumnDefinition Width="Auto" />
                                                        </Grid.ColumnDefinitions>
                                                        <FontIcon Glyph="&#xE74D;" />
                                                        <TextBlock Grid.Column="1" VerticalAlignment="Center" Text="{Binding Title}" Style="{ThemeResource BodyStrongTextBlockStyle}" Opacity="0.8" />
                                                        <TextBlock Grid.Column="2" Text="{Binding ItemCount}" Style="{ThemeResource CaptionTextBlockStyle}" VerticalAlignment="Center" TextAlignment="Right" Padding="0" Margin="0,-3,0,0" />
                                                    </Grid>
                                                </Grid>
                                            </Button>
                                        </StackPanel>
                                    </Grid>
                                </StackPanel>
                            </ListView.Header>
                            <ListView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <ItemsStackPanel AreStickyGroupHeadersEnabled="False"/>
                                </ItemsPanelTemplate>
                            </ListView.ItemsPanel>
                            <ListView.GroupStyle>
                                <GroupStyle>
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Key.Title}"/>
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                </GroupStyle>
                            </ListView.GroupStyle>
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <Grid ColumnSpacing="8">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="auto" />
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="auto" />
                                        </Grid.ColumnDefinitions>
                                        <Grid>
                                            <Border CornerRadius="12" Background="{Binding ColorString, Converter={StaticResource ColorStringToColorConverter}}" Width="24" Height="24" VerticalAlignment="Center" Opacity="{Binding Emoji, Converter={StaticResource ValueToOpacityConverter}, ConverterParameter='1.0|0.2'}" />
                                            <TextBlock Text="{Binding Emoji}" Visibility="{Binding Emoji, Converter={StaticResource ValueToVisibilityConverter}}" Style="{ThemeResource BodyTextBlockStyle}" HorizontalAlignment="Center" Margin="0,1,0,0" />
                                        </Grid>
                                        <TextBlock Grid.Column="1" Text="{Binding Title}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" Margin="0,0,0,2" />
                                        <TextBlock Grid.Column="2" Text="{Binding IncompleteItemCount}" Style="{ThemeResource CaptionTextBlockStyle}" VerticalAlignment="Center" Margin="0,0,0,1" />
                                    </Grid>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                            <ListView.ContextFlyout>
                                <MenuFlyout>
                                    <MenuFlyoutItem x:Name="menuFlyoutItemSaveHTML" x:Uid="MenuFlyoutItemSaveHTML" Text="XX Save as HTML" Click="_appBarButtonSaveHTML_Click">
                                        <MenuFlyoutItem.Icon>
                                            <FontIcon Glyph="&#xE78C;" Foreground="{ThemeResource AppBarItemForegroundThemeBrush}"/>
                                        </MenuFlyoutItem.Icon>
                                    </MenuFlyoutItem>
                                    <MenuFlyoutItem x:Name="menuFlyoutItemSavePDF" x:Uid="MenuFlyoutItemSavePDF" Text="XX Save as PDF" Click="_appBarButtonSavePDF_Click">
                                        <MenuFlyoutItem.Icon>
                                            <FontIcon Glyph="&#xEA90;" Foreground="{ThemeResource AppBarItemForegroundThemeBrush}"/>
                                        </MenuFlyoutItem.Icon>
                                    </MenuFlyoutItem>
                                    <MenuFlyoutItem x:Name="menuFlyoutItemSaveTXT" x:Uid="MenuFlyoutItemSaveTXT" Text="XX Save as TXT" Click="_appBarButtonSaveTXT_Click">
                                        <MenuFlyoutItem.Icon>
                                            <FontIcon Glyph="&#xF000;" Foreground="{ThemeResource AppBarItemForegroundThemeBrush}"/>
                                        </MenuFlyoutItem.Icon>
                                    </MenuFlyoutItem>
                                </MenuFlyout>
                            </ListView.ContextFlyout>
                        </ListView>
                    </Grid>
                </SplitView.Pane>
                <Grid>
                    <Grid Margin="10,0,0,0" x:Name="gridContent">
                        <local:RemindersContentPage x:Name="remindersContentPage" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                    </Grid>
                    <commonfeatures:ImagePreviewPage x:Name="imagePreviewPage" Visibility="Collapsed"/>
                </Grid>
            </SplitView>
        </Grid>
        <!-- WebView for use when printing -->
        <commoncontrols:WebViewPrintUserControl x:Name="webViewPrintUserControl" Grid.RowSpan="2" Visibility="Collapsed" />
    </Grid>
</featurebase:FeaturePage>
