<UserControl x:Class="TaskIt.Modules.Tasks.Views.NotesViews.List"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:CustomControls="clr-namespace:CustomControls;assembly=CustomControls" 
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Border Style="{StaticResource PageContentContainerStyle}">
        <telerik:RadDockPanel>
            <telerik:RadDockPanel x:Name="Toolbar" Style="{StaticResource ToolbarContainerStyle}" telerik:RadDockPanel.Dock="Top">
                <Grid Visibility="{Binding IsAddItemMode, Converter={StaticResource InvertedBooleanToVisibilityConverter}}">
                    <CustomControls:ImageButton Content="{Binding ResourceCommandNew}" Command="{Binding NewNoteCommand}" CommandParameter="{Binding NoteEntityType}" ImageSource="{Binding IconNewUri}" Visibility="{Binding ShowRowDetailsTabsToolbar}"/>
                </Grid>
            </telerik:RadDockPanel>
            <CustomControls:ClippingBorder Style="{StaticResource PageContentInnerContainerStyle}" telerik:RadDockPanel.Dock="Bottom">
                <Grid>
                    <TextBlock Text="{Binding ResourceMessageSaveBeforeAddingNotes}" Style="{StaticResource MessageLabelStyle}" 
                               Visibility="{Binding IsAddItemMode, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                    <Grid Visibility="{Binding IsAddItemMode, Converter={StaticResource InvertedBooleanToVisibilityConverter}}">
                        <TextBlock Text="{Binding ResourceNoNotesMessage}" Style="{StaticResource MessageLabelStyle}" 
                               Visibility="{Binding HasNotes, Converter={StaticResource InvertedBooleanToVisibilityConverter}}"/>
                        <ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Auto">
                            <StackPanel>
                                <ItemsControl ItemsSource="{Binding Notes}" Visibility="{Binding HasNotes, Converter={StaticResource BooleanToVisibilityConverter}}">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Margin="4,0">
                                                <Rectangle Style="{StaticResource SmallSpacerStyle}"/>
                                                <StackPanel Orientation="Horizontal">
                                                    <TextBlock Text="{Binding CreatedDate, StringFormat='{0:d}'}"/>
                                                    <TextBlock Text=" - "/>
                                                    <TextBlock Text="{Binding TaskItUser.FullName}"/>
                                                </StackPanel>
                                                <TextBlock Text="{Binding Text}" TextWrapping="Wrap"/>
                                                <Rectangle Style="{StaticResource SmallSpacerStyle}"/>
                                            </StackPanel>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>
                            </StackPanel>
                        </ScrollViewer>
                    </Grid>
                </Grid>
            </CustomControls:ClippingBorder>
        </telerik:RadDockPanel>
    </Border>

</UserControl>
