<UserControl x:Class="TradeBlotter.Views.DividendView"
             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"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
  <UserControl.Resources>
      <GroupStyle x:Key="PricingGroupStyle">
      <GroupStyle.HeaderTemplate>
        <DataTemplate>
          <TextBlock 
            x:Name="txt" 
            Background="{StaticResource Brush_HeaderBackground}"
            FontWeight="Bold"
            Foreground="White"
            Margin="1"
            Padding="4,2,0,2"
            Text="People" 
            />
          <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Path=Name}" Value="True">
              <Setter TargetName="txt" Property="Text" Value="Companies" />
            </DataTrigger>
          </DataTemplate.Triggers>
        </DataTemplate>
      </GroupStyle.HeaderTemplate>
    </GroupStyle>

    <Style x:Key="ValuationItemStyle" TargetType="{x:Type ListViewItem}">
      <Setter Property="HorizontalContentAlignment" Value="Stretch" />
      <Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}" />
      <Style.Triggers>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="ItemsControl.AlternationIndex" Value="1" />
            <Condition Property="IsSelected" Value="False" />
            <Condition Property="IsMouseOver" Value="False" />
          </MultiTrigger.Conditions>
          <Setter Property="Background" Value="#EEEEEEEE" />
        </MultiTrigger>
      </Style.Triggers>
    </Style>
		
  </UserControl.Resources>

  <wpfx:BusyIndicator Name="BusyBar" IsBusy="{Binding Path=BusyIndicator}" BusyContent="Loading Dividend History...">
        <Grid  Background="LightGray">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto" />
        <ColumnDefinition Width="6" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="30" />
        <RowDefinition Height="3" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Label Grid.Row="0" Grid.Column="2" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
    <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical">
    <Label Margin="2,0" Content="Watch List" HorizontalAlignment="Left" ></Label>
    <ComboBox Margin="2,1" ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" ></ComboBox>
    <Label Margin="2,0" Content="Symbol" HorizontalAlignment="Left" ></Label>			
    <ComboBox Margin="2,1" ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
			<ComboBox.ItemsPanel>
				<ItemsPanelTemplate>
					<VirtualizingStackPanel/>
				</ItemsPanelTemplate>
			</ComboBox.ItemsPanel>			
		</ComboBox>
    <Button Margin="2,1"  Content="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></Button>
    <Button Margin="2,1"  Content="Get Latest DivExDates" HorizontalAlignment="Left" Command="{Binding Path=GetLatestDivExDatesCommand}"></Button>
    </StackPanel>
    <DockPanel Grid.Row="2" Grid.RowSpan="3" Grid.Column="2" >
    <telerik:RadGridView AlternationCount="2" AlternateRowBackground="Bisque" IsReadOnly="true" ShowGroupFooters="False" ItemsSource="{Binding Path=AllDividendHistory, ValidatesOnDataErrors=True}" AutoGenerateColumns="False" >
    <telerik:RadGridView.Columns>
      <telerik:GridViewDataColumn Header="Symbol"  DataMemberBinding="{Binding Path=Symbol}" />
      <telerik:GridViewDataColumn Header="DividendType"  DataMemberBinding="{Binding Path=DividendType}" />
      <telerik:GridViewDataColumn Header="CashAmount" DataMemberBinding="{Binding Path=CashAmount,StringFormat='{}{0:C}'}" />
      <telerik:GridViewDataColumn Header="DivExDate"  DataMemberBinding="{Binding Path=DivExDate,StringFormat='{}{0:MM/dd/yyyy}'}" />
      <telerik:GridViewDataColumn Header="DeclarationDate"  DataMemberBinding="{Binding Path=DeclarationDate,StringFormat='{}{0:MM/dd/yyyy}'}" />
      <telerik:GridViewDataColumn Header="RecordDate"  DataMemberBinding="{Binding Path=RecordDate,StringFormat='{}{0:MM/dd/yyyy}'}" />
      <telerik:GridViewDataColumn Header="PaymentDate"  DataMemberBinding="{Binding Path=PaymentDate,StringFormat='{}{0:MM/dd/yyyy}'}" />
      <telerik:GridViewDataColumn Header="Modified"  DataMemberBinding="{Binding Path=Modified,StringFormat='{}{0:MM/dd/yyyy}'}" />
    </telerik:RadGridView.Columns>
    </telerik:RadGridView>
  </DockPanel>
</Grid>
</wpfx:BusyIndicator>
</UserControl>

