<?xml version="1.0" encoding="UTF-8" ?>
<ContentView
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
    xmlns:controls="clr-namespace:Bit.App.Controls"
    xmlns:effects="clr-namespace:Bit.App.Effects"
    xmlns:view="clr-namespace:Bit.Core.Models.View;assembly=BitwardenCore"
    x:Name="_mainOverlay"
    x:DataType="controls:AccountSwitchingOverlayViewModel"
    x:Class="Bit.App.Controls.AccountSwitchingOverlayView"
    BackgroundColor="#22000000"
    Padding="0"
    IsVisible="False">
    <StackLayout
        x:Name="_accountListContainer"
        VerticalOptions="Fill"
        HorizontalOptions="FillAndExpand"
        BackgroundColor="Transparent">
        <Frame
            Padding="0"
            HorizontalOptions="Fill"
            VerticalOptions="Start"
            xct:ShadowEffect.Color="Black"
            xct:ShadowEffect.Radius="10"
            xct:ShadowEffect.OffsetY="3">
            <ListView
                x:Name="_accountListView"
                ItemsSource="{Binding BindingContext.AccountViews, Source={x:Reference _mainOverlay}}"
                BackgroundColor="{DynamicResource BackgroundColor}"
                VerticalOptions="Start"
                RowHeight="{Binding AccountListRowHeight, Source={x:Reference _mainOverlay}}"
                effects:ScrollViewContentInsetAdjustmentBehaviorEffect.ContentInsetAdjustmentBehavior="Never">
                <ListView.ItemTemplate>
                    <DataTemplate x:DataType="view:AccountView">
                        <controls:AccountViewCell
                            Account="{Binding .}"
                            SelectAccountCommand="{Binding SelectAccountCommand, Source={x:Reference _mainOverlay}}"
                            LongPressAccountCommand="{Binding LongPressAccountCommand, Source={x:Reference _mainOverlay}}"
                            />
                    </DataTemplate>
                </ListView.ItemTemplate>
                <ListView.Effects>
                    <effects:ScrollViewContentInsetAdjustmentBehaviorEffect />
                </ListView.Effects>
            </ListView>
        </Frame>
        <BoxView
            BackgroundColor="Transparent"
            HorizontalOptions="Fill"
            VerticalOptions="FillAndExpand">
            <BoxView.GestureRecognizers>
                <TapGestureRecognizer Tapped="FreeSpaceOverlay_Tapped" />
            </BoxView.GestureRecognizers>
        </BoxView>
    </StackLayout>
</ContentView>
