<UserControl
    x:Class="Wallet.Avalonia.WalletNavigationCollectionView"
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vm="using:Wallet"
    x:DataType="vm:WalletNavigationCollectionViewModel">
    <Overflow
        HorizontalAlignment="Center"
        ItemContainerTemplateSelector="{ReflectionBinding Template}"
        ItemsSource="{Binding}"
        SelectedItem="{Binding SelectedItem, Mode=TwoWay}">
        <Overflow.Styles>
            <Style Selector="Overflow.Closed">
                <Setter Property="Margin" Value="1,2,1,0" />
                <Style Selector="^ StackPanel">
                    <Setter Property="Orientation" Value="Vertical" />
                </Style>
            </Style>
            <Style Selector="Overflow.Opened">
                <Setter Property="Margin" Value="12,2,12,0" />
                <Style Selector="^ StackPanel">
                    <Setter Property="Orientation" Value="Horizontal" />
                </Style>
            </Style>
        </Overflow.Styles>
        <Interaction.Behaviors>
            <DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="True">
                <AddClassAction ClassName="Opened" RemoveIfExists="True" />
                <RemoveClassAction ClassName="Closed" />
            </DataTriggerBehavior>
            <DataTriggerBehavior Binding="{Binding $parent[NavigationView].IsPaneOpen}" Value="False">
                <AddClassAction ClassName="Closed" RemoveIfExists="True" />
                <RemoveClassAction ClassName="Opened" />
            </DataTriggerBehavior>
        </Interaction.Behaviors>
    </Overflow>
</UserControl>
