<UserControl xmlns="https://github.com/avaloniaui"
             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:vm="clr-namespace:PSCHelpdesk.Plugins.Nextcloud.ViewModels"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="PSCHelpdesk.Plugins.Nextcloud.Views.NotesView"
             xmlns:md="https://github.com/whistyun/Markdown.Avalonia"
             x:DataType="vm:NotesViewModel">
    <Design.DataContext>
        <vm:NotesViewModel></vm:NotesViewModel>
    </Design.DataContext>
    <SplitView IsPaneOpen="True"
        DisplayMode="Inline"
        OpenPaneLength="300">
        <SplitView.Pane>
            <ListBox ItemsSource="{Binding Notes}"  >
                <ListBox.Styles> 
                    <Style Selector="ListBoxItem">
                        <Setter Property="Padding" Value="0" />
                    </Style> 
                </ListBox.Styles>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border Padding="1" Margin="0">
                            <Button Content="{Binding Title}" Command="{Binding $parent[ListBox].DataContext.SelectNote }" CommandParameter="{Binding .}"></Button>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>    
        </SplitView.Pane>
        <Grid ColumnDefinitions="*,*">
            <ScrollViewer>
                <StackPanel Margin="5 0">
                    <TextBlock Margin="0 5">Title</TextBlock>
                    <TextBox Text="{Binding SelectedNote.Title}"></TextBox>
                    <TextBlock Margin="0 5">Content</TextBlock>
                    <TextBox Text="{Binding SelectedNote.Content}"></TextBox>
                </StackPanel>
            </ScrollViewer>
            <md:MarkdownScrollViewer  Grid.Column="1" 
                                      Markdown="{Binding SelectedNote.Content}"/>
        </Grid>
    </SplitView>
</UserControl>