<Page
    x:Class="_07_AdvancedChat.Views.ChatsPage"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="using:_07_AdvancedChat.Shared"
	xmlns:linphone="using:Linphone"
	Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

	<Page.Resources>
		<local:ChatRoomToStringConverter x:Key="ChatRoomToStringConverter" />
	</Page.Resources>
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="0.3*" />
			<ColumnDefinition Width="0.7*" />
		</Grid.ColumnDefinitions>
		<Border BorderBrush="{ThemeResource SystemAccentColorLight3}"
                BorderThickness="2,2,1,2"
                Padding="2">
			<StackPanel Grid.Column="0" Orientation="Vertical">
				<Button x:Name="NewChatRoom" Click="NewChatRoom_Click" Content="Create a new basic ChatRoom" Tag="false" HorizontalAlignment="Stretch" />
				<Button x:Name="NewSecureChatRoom" Click="NewChatRoom_Click" Content="Create a new secure ChatRoom" Tag="true" HorizontalAlignment="Stretch" />
				<Button x:Name="NewGroupChatRoom" Click="NewGroupChatRoom_Click" Content="Create a new group ChatRoom" HorizontalAlignment="Stretch" />
				<ListView x:Name="ChatRoomsLV" SelectionMode="Single" IsItemClickEnabled="True" ItemClick="ChatRoomsLV_ItemClick">
					<ListView.ItemTemplate>
						<DataTemplate x:DataType="linphone:ChatRoom">
							<StackPanel Orientation="Horizontal">
								<Border BorderThickness="1" BorderBrush="{ThemeResource SystemAccentColorLight3}" CornerRadius="10" Margin="0,0,5,0" Padding="3,0,3,0">
									<TextBlock Text="{x:Bind UnreadMessagesCount}" FontSize="14" />
								</Border>
								<TextBlock Text="{x:Bind Converter={StaticResource ChatRoomToStringConverter}}" FontSize="14" />
							</StackPanel>
						</DataTemplate>
					</ListView.ItemTemplate>
				</ListView>
			</StackPanel>
		</Border>
		<Border BorderBrush="{ThemeResource SystemAccentColorLight3}"
                BorderThickness="1,2,2,2"
                Padding="2"
				Grid.Column="1">
			<Frame x:Name="ChatRoomFrame" />
		</Border>
	</Grid>
</Page>