<UserControl x:Class="ModernFlyouts.Controls.SessionsPanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ui="http://schemas.modernwpf.com/2019"
             xmlns:root="clr-namespace:ModernFlyouts"
             xmlns:rootui="clr-namespace:ModernFlyouts.UI"
             xmlns:local="clr-namespace:ModernFlyouts.Controls"
             xmlns:mediaControl="clr-namespace:ModernFlyouts.Core.Media.Control;assembly=ModernFlyouts.Core"
             mc:Ignorable="d"
             d:DesignHeight="206" d:DesignWidth="354"
             MaxWidth="{DynamicResource FlyoutWidth}" DataContext="{x:Static root:FlyoutHandler.Instance}">

    <local:ContentScrollViewer x:Name="ContentScrollViewer" MaxHeight="{Binding UIManager.CalculatedSessionsPanelMaxHeight, Mode=OneWay}"
                               ContentHeight="{x:Static rootui:UIManager.DefaultSessionControlHeight}"
                               ContentWidth="{x:Static rootui:UIManager.FlyoutWidth}"
                               VerticalSpacing="{x:Static rootui:UIManager.DefaultVerticalSpacing}">
        <ItemsControl ItemsSource="{Binding AudioFlyoutHelper.AllMediaSessions}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <ui:SimpleStackPanel
                        Orientation="{Binding Source={x:Static root:FlyoutHandler.Instance}, Path=UIManager.SessionsPanelOrientation}"
                        Spacing="{Binding Source={x:Static root:FlyoutHandler.Instance}, Path=UIManager.CalculatedSessionsPanelSpacing}"/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.Resources>
                <DataTemplate DataType="{x:Type mediaControl:MediaSession}">
                    <local:SessionControl />
                </DataTemplate>
            </ItemsControl.Resources>
        </ItemsControl>
    </local:ContentScrollViewer>

</UserControl>
