<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:ScottPlot="clr-namespace:ScottPlot.Avalonia;assembly=ScottPlot.Avalonia"
             xmlns:vm="using:PortfolioManager.ViewModels"
             xmlns:vw="using:PortfolioManager.Views"
             xmlns:md="using:PortfolioManager.Models"
             xmlns:local="using:PortfolioManager.UIUtils"		
             xmlns:li="using:LoadingIndicators.Avalonia"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:DataType="vm:BollingerBandViewModel"
             x:Class="PortfolioManager.Views.BollingerBandView">
  <UserControl.Resources>
      <local:CurrencyValueConverter x:Key="CurrencyFormat"/>
      <local:DoubleValueConverter x:Key="DoubleFormat"/>
      <local:IntValueConverter x:Key="IntFormat"/>
      <local:DateValueConverter x:Key="DateFormat"/>
      <local:RMultipleValueConverter x:Key="RMultipleFormat"/>
      <local:BoolValueConverter x:Key="BoolFormat"/>
      <local:OSValueConverter x:Key="OSValueConverter"/>
  </UserControl.Resources>

	<Grid Background="LightGray">
    <li:LoadingIndicator ZIndex="1" IsActive="{Binding IsBusy}" Mode="Arcs" SpeedRatio="1.2" Width="200" Height="200"/>
    <DockPanel>
      <Grid Margin="4">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="6" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="Auto" />
          <RowDefinition Height="3" />
          <RowDefinition Height="30" />
          <RowDefinition Height="30" />
          <RowDefinition Height="30" />          
          <RowDefinition Height="30" />
          <RowDefinition Height="30" />
          <RowDefinition Height="89*" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
          <Label Content="Watch List" HorizontalAlignment="Left" ></Label>
          <ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneWay}" SelectedItem="{Binding Path=SelectedWatchList}">
            <ComboBox.ItemsPanel>
              <ItemsPanelTemplate>
                <VirtualizingStackPanel/>
              </ItemsPanelTemplate>
            </ComboBox.ItemsPanel>
          </ComboBox>

          <Label Content="Symbols" HorizontalAlignment="Left" ></Label>
          <ComboBox ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol}">
            <ComboBox.ItemsPanel>
              <ItemsPanelTemplate>
                <VirtualizingStackPanel/>
              </ItemsPanelTemplate>
            </ComboBox.ItemsPanel>
          </ComboBox>
          <Label Content="Day Count" HorizontalAlignment="Left" ></Label>
          <ComboBox ItemsSource="{Binding Path=DayCounts, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDayCount}"/>
          <Button Content="Refresh" HorizontalAlignment="Stretch" Command="{Binding Path=Refresh}"></Button>     
          <CheckBox Content="Show Least Squares" IsChecked="{Binding Mode=TwoWay,Path=UseLeastSquaresFit}" HorizontalAlignment="Stretch" />
          <CheckBox Content="Sync Trade To Band" IsChecked="{Binding Mode=TwoWay,Path=SyncTradeToBand}" HorizontalAlignment="Stretch" />
          <CheckBox Content="Show Trade Labels" IsChecked="{Binding Mode=TwoWay,Path=ShowTradeLabels}" HorizontalAlignment="Stretch" />
          <CheckBox Content="Show Insider Transactions" IsChecked="{Binding Mode=TwoWay,Path=CheckBoxShowInsiderTransactions}" HorizontalAlignment="Stretch" />
        </StackPanel>
		</Grid>

        <Grid> 
        <Grid.RowDefinitions>
          <RowDefinition Height="3*" />
          <RowDefinition Height="*" />
        </Grid.RowDefinitions>
            <Grid >
              <Grid.RowDefinitions>
                <RowDefinition Height="24" />
                <RowDefinition Height="*" />
              </Grid.RowDefinitions>
              <TextBlock Grid.Row="0" FontSize="16" Text="{Binding Path=GraphTitle}"  HorizontalAlignment="Center"></TextBlock>  
              <ContentControl Grid.Row="1" Content="{Binding Path=Plotter}"/>
          </Grid>
      </Grid>
    </DockPanel>
  </Grid>
</UserControl>
