<UserControl x:Class="TradeBlotter.Views.DividendPaymentView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:dc="clr-namespace:TradeBlotter.UIUtils"
             xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:wpfx="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:Effects="clr-namespace:Telerik.Windows.Controls.ColorEditor.Effects;assembly=Telerik.Windows.Controls.Input" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
    </UserControl.Resources>
    <wpfx:BusyIndicator x:Name="BusyBar" BusyContent="Loading Dividend Payments..." IsBusy="{Binding BusyIndicator}">
        <Grid  Background="LightGray">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="6" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="4" />
                <RowDefinition Height="2*" />
                <RowDefinition Height="3" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Label Grid.Row="0" Grid.Column="2" FontFamily="Arial" Content="{Binding Title}" HorizontalAlignment="Center" FontSize="20"/>

            <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical">
            <Label Margin="2,0" Content="Accounts" HorizontalAlignment="Left" />
            <wpfx:CheckComboBox Margin="2,1" MaxWidth="100" ItemsSource="{Binding Accounts, Mode=OneWay}" SelectedValue="{Binding SelectedAccounts, ValidatesOnDataErrors=False}" Validation.ErrorTemplate="{x:Null}" />
            <Label Margin="2,0" Content="Symbol" HorizontalAlignment="Left" />
            <!--<wpfx:CheckComboBox Margin="2,1" MaxWidth="100" ItemsSource="{Binding Symbols, Mode=OneWay}" SelectedItemsOverride="{Binding SelectedItemsOverride, Mode=OneWay}" SelectedValue="{Binding SelectedSymbols, Mode=TwoWay}"  >-->
        <wpfx:CheckComboBox Margin="2,1" MaxWidth="100" ItemsSource="{Binding Symbols, Mode=OneWay}" SelectedItemsOverride="{Binding SelectedItemsOverride, Mode=OneWay}" SelectedValue="{Binding SelectedSymbols, Mode=TwoWay}"  >
          </wpfx:CheckComboBox>
                <Button Margin="2,1"  Content="Reset" HorizontalAlignment="Left" Command="{Binding RefreshCommand}"/>
                <Button Margin="2,1" Content="Export" HorizontalAlignment="Left" Command="{Binding SaveCommand}"/>
            </StackPanel>
            <DockPanel Grid.Row="4" Grid.Column="2" >
                <telerik:RadGridView AlternationCount="2" AutoGenerateColumns="False" AlternateRowBackground="Bisque" dc:GridExportGraphBehavior.ExportExcelProperty="{Binding SaveDocument}" ItemsSource="{Binding DividendPayments, ValidatesOnDataErrors=False}" ShowGroupFooters="False" >
                    <telerik:RadGridView.Columns>
                      <telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding PaymentDate, StringFormat=\{0:MM/dd/yyyy\}}" Header="Payment Date"/>
                      <telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding Account}" Header="Account"/>
                      <telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding Symbol}" Header="Symbol"/>
                      <telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding Amount, StringFormat=\{0:C\}}" Header="Amount"/>
                      <telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding TotalAnnualAmount, StringFormat=\{0:C\}}" Header="Total Annual Amount"/>                      
                      <telerik:GridViewDataColumn IsReadOnly="True" DataMemberBinding="{Binding TotalAmount, StringFormat=\{0:C\}}" Header="Total Amount"/>
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
            </DockPanel>
            <DockPanel Grid.Row="2" Grid.Column="2" >
                <d3:ChartPlotter Background="WhiteSmoke" Margin="10,10,20,10" x:Name="prices" LegendVisibility="Hidden" NewLegendVisible="False" d3:Viewport2D.UsesApproximateContentBoundsComparison="False" BorderThickness="0">
                    <d3:ChartPlotter.MainHorizontalAxis>
                        <d3:HorizontalDateTimeAxis x:Name="dateAxis"/>
                    </d3:ChartPlotter.MainHorizontalAxis>
                    <d3:ChartPlotter.MainVerticalAxis>
                        <d3:VerticalAxis x:Name="countAxis" MinWidth="40" MaxWidth="40"/>
                    </d3:ChartPlotter.MainVerticalAxis>
                    <d3:LineGraph x:Name="Values" DataSource="{Binding Values}" Stroke="MidnightBlue" StrokeThickness="2"/>
                    <d3:CursorCoordinateGraph x:Name="cursorGraph" dc:CoordinateGraphBehavior.XTextMappingProperty="MM/dd/yyyy" LineStrokeThickness="1"/>
                    <d3:VerticalAxisTitle FontFamily="Arial" Content="Dividend"/>
                    <d3:HorizontalAxisTitle FontFamily="Arial" Content="" />
                    <d3:MarkerPointsGraph x:Name="MarkerPointsGraph" DataSource="{Binding ValuePoints}">
                        <d3:MarkerPointsGraph.Marker>
                            <d3:CirclePointMarker Size="9" Fill="DarkGreen">
                                <d3:CirclePointMarker.Pen>
                                    <Pen Thickness="1" Brush="DarkGreen"/>
                                </d3:CirclePointMarker.Pen>
                            </d3:CirclePointMarker>
                        </d3:MarkerPointsGraph.Marker>
                    </d3:MarkerPointsGraph>

                    <d3:MarkersPointsGraph x:Name="DividendPaymentsMarkersPointsGraph" DataSource="{Binding ValuePoints}" Markers="{Binding Markers}" >
                    </d3:MarkersPointsGraph>

                </d3:ChartPlotter>
            </DockPanel>
            <GridSplitter Background="LightBlue" ResizeDirection="Rows" Grid.Column="2" Grid.ColumnSpan="1" Grid.Row="3" Width="Auto" Height="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0"/>
        </Grid>
    </wpfx:BusyIndicator>
</UserControl>

